core-router

221 views
Skip to first unread message

Erik Ringsmuth

unread,
Nov 6, 2014, 9:40:06 PM11/6/14
to polym...@googlegroups.com
Is the Polymer team working on a core-router or is core-animated-pages and flatiron-director as far as you're going right now? Would you be interested in building something off a fork of app-router? I'm guessing you'd have your Polymer way of doing things and tighter integration with core-animated-pages. I think a lot of people in the Polymer community are hoping for an official core-router. app-router is really just a hobby project.

Ian MacLeod

unread,
Nov 11, 2014, 11:35:27 AM11/11/14
to Erik Ringsmuth, polym...@googlegroups.com

Not entirely official, but I've been hacking at https://github.com/Polymore/more-routing as a more robust alternative for us. (we're still discussing whether we want something like this as core-routing, or whether we'd rather have several options to recommend).

It's very alpha at the moment (potentially buggy and likely to have breaking changes) - but seems to show a lot of promise. I'd love to get some feedback on it as to where it has rough edges, particular when integrating with things like core-animated-pages.


On Thu, Nov 6, 2014, 18:40 Erik Ringsmuth <erik.ri...@gmail.com> wrote:
Is the Polymer team working on a core-router or is core-animated-pages and flatiron-director as far as you're going right now? Would you be interested in building something off a fork of app-router? I'm guessing you'd have your Polymer way of doing things and tighter integration with core-animated-pages. I think a lot of people in the Polymer community are hoping for an official core-router. app-router is really just a hobby project.

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/d2ac5cee-584d-4c5f-9c41-f1943d245904%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

danel...@hotmail.com

unread,
Nov 15, 2014, 8:11:31 PM11/15/14
to polym...@googlegroups.com, erik.ri...@gmail.com
Sounds great, I will help check it out.  +1 for router being part of the core.

Chuck Horton

unread,
Nov 16, 2014, 12:44:04 PM11/16/14
to polym...@googlegroups.com, erik.ri...@gmail.com
Another +1 for router being part of the core,

Erik Ringsmuth

unread,
Nov 25, 2014, 7:37:01 PM11/25/14
to polym...@googlegroups.com, erik.ri...@gmail.com
Hey Ian, I think I've finally groked more-routing.

Rob's more-routing branch diff on his contacts-app made it click.

more-routing really feels like an extension of core-pages and core-animaged-pages. The contacts-app index.html looks something like this.

<more-routing driver="hash"></more-routing>
<more-route-selector routes="['/add', '/contacts/:id', '/']" selectedIndex="{{selected}}" selectedParams="{{params}}"></more-route-selector>

<core-animated-pages selected="{{selected}}">
  <section>
    <add-page></add-page>
  </section>
  <section>
    <info-page params="{{params}}"></info-page>
  </section>
  <section>
    <contacts-page></contacts-page>
  </section>
</core-animated-pages>

more-routing sits outside of core-animated-pages and coordinates which page is selected given the defined routes and the current URL.

Looking at the docs, more-route-switch feels like the more natural way of expressing routes to me. What if you did something like this that extends core-animaged-pages to achieve the same type of structure?

<core-animated-pages is="more-routing" driver="hash">
  <section when-route="/add">
    <add-page></add-page>
  </section>
  <section when-route="/contacts/:id" params="{{infoParams}}">
    <info-page params="{{infoParams}}"></info-page>
  </section>
  <section when-route="/">
    <contacts-page></contacts-page>
  </section>
</core-animated-pages>

I did something similar to make app-router work with core-animated-pages except in my case I wrap all of the routes in a <core-animated-pages> tag hidden in the shadow DOM https://erikringsmuth.github.io/app-router/#/core-animated-pages. I made an app-router fork of Rob's contacts-app showing what it looks like.

I think just putting the route on the <section> for the active page rather than outside in a <more-route-selector> tag would make it a lot more intuitive. The fact that core-pages uses core-selector has seemed weird to me all along. core-selector just doesn't feel like the right tool to build a router. On the other hand, it's simple enough to hide the fact that it's selecting pages using a selected="num" attribute.

-Erik
Reply all
Reply to author
Forward
0 new messages