You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
If we plan to deprecate the space pen View class, we need a story for what folks can move to. Some kind of system that interoperates with custom elements. Something that UI heavy packages like settings view and fnr can use.
Is that really required? What if the packages also would just extend HTMLElements as views? I recently rewrote my package witch HTMLElements instead of using SpacePen and it worked great.
After discussion and tinkering, we have a direction. The goal is a view system that uses the browser's built in mechanisms as much as possible, embracing new tech like custom elements and Object.observe. Much will be borrowed from Polymer.
We're encouraging a Model/View approach. Models are just plain objects. e.g. This is a fine model:
Model= {
message:'Find in Buffer'
}
A model class:
classFindModelmessage:'Find in Buffer'constructor:->
Views are custom elements with an HTML template. Templates support Polymer's template data-binding.
We'll provide a registerElement method from a new module called element-kit. It is basically a wrapper around document.registerElement with slightly cleaner syntax.
Example: Find panel
Model
classFindModelmessage:'Find in Buffer'constructor:->search: (text) -># do search on current editor
We'll provide a registerElement method from a new module called
element-kit.
It is basically a wrapper around document.registerElement with slightly
cleaner syntax.
Example: Find panel
I like the resemblance of Polymer in this. Google are pushing that thing pretty badly and it's well thought out to really become big. Also, everything that uses a web components approach is probably the right way forward.
@mark-hahn can you elaborate? There are definitely more distinct entities: a model, a view, a template, and registration. But overall, UIs built with this should be simpler. Data binding will remove a bunch of logic, and the view should have very little logic, just calling things on the model.
I was just comparing it my usual spacepen view, object model, and jquery
binding. If I was building a large app, like Atom itself, the complexity
would be needed. But most packages are a simple panel at most. Can I still
use my simple spacepen?
It is possible for us to get rid of the registration step
That would be nice. I noticed in the docs that the state serializer used
registration at some point in the past. I have just been taking state
objects in the activate and returning them in serialize and it works
great. Simplicity is the greatest virtue. :-)
Space pen is going away
That's a shame. The barrier to entry for new package developers will
jump. It's not so much the amount of code but the learning curve. This is
definitely beyond the skill level of the typical web designer and Atom is
supposed to be attracting web designers.
So that means I will have to rewrite the views on my 12 packages. I guess
that is to be expected since I knew Atom was unstable
I have but one request. Please think through carefully what benefits
package writers will get with this new scheme. Don't use the new Chrome
features because they are cool.
Space pen is going away, so something like this will be the only way.
2 ways to simplify:
It is possible for us to get rid of the registration step by
integrating it with the element registration
you dont need the model if you dont want it. You can insert the
view as a panel like this: coffee view =
document.createElement('my-find') @panel = atom.workspace.addBottomPanel
item: view
—
Reply to this email directly or view it on GitHub #3752 (comment).
I have been on a rant and I apologize. I said that this was right for Atom core and now I realize packages have to exactly match core.
P.S. Separation of concerns has nothing to do with files. Separating html by putting it at the top of the view file is a great separation. To me keeping the view in one file is a great feature. A view is really a kind of single concern when compared to a model.
P.S. Separation of concerns has nothing to do with files. Separating html by putting it at the top of the view file is a great separation. To me keeping the view in one file is a great feature. A view is really a kind of single concern when compared to a model.
Agreed, but encouraging separate files also encourages the separation of concerns (at least more so than now). That being said, I do still believe you can inline your views if you prefer that approach. Although it will likely not be as "pretty".
We won't be using SpacePen in core, but I see no problem with people continuing to use it if it's a good fit for their packages. We'll need to make a couple slight breaking changes to enable it to keep working in packages without support from core, but the library should continue to work indefinitely.
We've all talked about this and decided 2 things: the injection of globals via polymer isnt something we want to support long term, and it doesnt exactly fit in with the API freeze (it's additive). We plan to revisit this when we're into 1.0 initiative and can spend more time on it.
For now, @nathansobo is updating space-pen to be forward compatible and used outside of core. We will have a period of time between the freeze and 1.0 where our a recommendation for view code will range from vanilla custom elements to space-pen.
We've all talked about this and decided 2 things: the injection of globals
via polymer isnt something we want to support long term, and it doesnt
exactly fit in with the API freeze (it's additive). We plan to revisit this
when we're into 1.0 initiative and can spend more time on it.
I opened #5756 with a high-level overview of where we're at today and started a list of options. I'm closing this issue in favor of that one, in the interest of starting fresh with the current thinking & requirements.
This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!
Activity
[-]View system for packages[/-][+]API for creating views in packages[/+]philipgiuliani commentedon Oct 8, 2014
Is that really required? What if the packages also would just extend HTMLElements as views? I recently rewrote my package witch HTMLElements instead of using SpacePen and it worked great.
benogle commentedon Oct 27, 2014
After discussion and tinkering, we have a direction. The goal is a view system that uses the browser's built in mechanisms as much as possible, embracing new tech like custom elements and
Object.observe. Much will be borrowed from Polymer.We're encouraging a Model/View approach. Models are just plain objects. e.g. This is a fine model:
A model class:
Views are custom elements with an HTML template. Templates support Polymer's template data-binding.
We'll provide a
registerElementmethod from a new module calledelement-kit. It is basically a wrapper arounddocument.registerElementwith slightly cleaner syntax.Example: Find panel
Model
A custom element view:
{registerElement} = require 'element-kit' Template = require('../templates/find.html') FindElement = registerElement 'my-find', createdCallback: -> @appendChild(Template.clone()) @rootTemplate = @querySelector('template') @input = @querySelector('atom-text-editor') @classList.add 'tool-panel', 'panel-bottom', 'padded' atom.events.add this, 'button', 'click', -> @confirm() atom.events.add this, 'core:confirm', -> @confirm() confirm: -> @model.search(@input.value) getModel: -> @model setModel: (@model) -> # setup the data binding @rootTemplate?.model = @modelAnd the template in
../templates/find.htmlRegistration. We need to tie the View to the Model with the view provider system:
Invocation. Create the model, then attach a panel:
mark-hahn commentedon Oct 27, 2014
Very powerful. It is a shame it is so much more complex.
On Mon, Oct 27, 2014 at 11:31 AM, Ben Ogle [email protected] wrote:
batjko commentedon Oct 27, 2014
I like the resemblance of Polymer in this. Google are pushing that thing pretty badly and it's well thought out to really become big. Also, everything that uses a web components approach is probably the right way forward.
benogle commentedon Oct 27, 2014
@mark-hahn can you elaborate? There are definitely more distinct entities: a model, a view, a template, and registration. But overall, UIs built with this should be simpler. Data binding will remove a bunch of logic, and the view should have very little logic, just calling things on the model.
mark-hahn commentedon Oct 27, 2014
I was just comparing it my usual spacepen view, object model, and jquery
binding. If I was building a large app, like Atom itself, the complexity
would be needed. But most packages are a simple panel at most. Can I still
use my simple spacepen?
On Mon, Oct 27, 2014 at 12:33 PM, Ben Ogle [email protected] wrote:
benogle commentedon Oct 27, 2014
Space pen is going away, so something like this will be the only way.
2 ways to simplify:
mark-hahn commentedon Oct 27, 2014
That would be nice. I noticed in the docs that the state serializer used
registration at some point in the past. I have just been taking state
objects in the activate and returning them in serialize and it works
great. Simplicity is the greatest virtue. :-)
That's a shame. The barrier to entry for new package developers will
jump. It's not so much the amount of code but the learning curve. This is
definitely beyond the skill level of the typical web designer and Atom is
supposed to be attracting web designers.
So that means I will have to rewrite the views on my 12 packages. I guess
that is to be expected since I knew Atom was unstable
I have but one request. Please think through carefully what benefits
package writers will get with this new scheme. Don't use the new Chrome
features because they are cool.
On Mon, Oct 27, 2014 at 1:55 PM, Ben Ogle [email protected] wrote:
6 remaining items
mark-hahn commentedon Oct 30, 2014
I have been on a rant and I apologize. I said that this was right for Atom core and now I realize packages have to exactly match core.
P.S. Separation of concerns has nothing to do with files. Separating html by putting it at the top of the view file is a great separation. To me keeping the view in one file is a great feature. A view is really a kind of single concern when compared to a model.
thomasjo commentedon Oct 30, 2014
Agreed, but encouraging separate files also encourages the separation of concerns (at least more so than now). That being said, I do still believe you can inline your views if you prefer that approach. Although it will likely not be as "pretty".
nathansobo commentedon Oct 30, 2014
We won't be using SpacePen in core, but I see no problem with people continuing to use it if it's a good fit for their packages. We'll need to make a couple slight breaking changes to enable it to keep working in packages without support from core, but the library should continue to work indefinitely.
benogle commentedon Oct 30, 2014
We've all talked about this and decided 2 things: the injection of globals via polymer isnt something we want to support long term, and it doesnt exactly fit in with the API freeze (it's additive). We plan to revisit this when we're into 1.0 initiative and can spend more time on it.
For now, @nathansobo is updating space-pen to be forward compatible and used outside of core. We will have a period of time between the freeze and 1.0 where our a recommendation for view code will range from vanilla custom elements to space-pen.
The stuff I outlined here is at https://github.com/atom/elmer and https://github.com/benogle/template-explore for future reference.
mark-hahn commentedon Oct 30, 2014
Awesome. Thanks.
On Thu, Oct 30, 2014 at 2:29 PM, Ben Ogle [email protected] wrote:
thedaniel commentedon Feb 26, 2015
I opened #5756 with a high-level overview of where we're at today and started a list of options. I'm closing this issue in favor of that one, in the interest of starting fresh with the current thinking & requirements.
lock commentedon Jan 23, 2019
This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!