What about providing access to shadow members via some kind of specialized attribute notation?

61 views
Skip to first unread message

Chris Gallo

unread,
Jul 18, 2014, 2:00:30 PM7/18/14
to polym...@googlegroups.com
For example, it would be useful to be able to say things like:
<paper-menu-button $.icon.size="48> 
or 
<.... $-icon-size=".."> etc.
Where the core-icon in paper-menu-button would have an id of 'icon'.

One could use the same pattern for adjusting the shadow dom:
<shadow $.myelem.vertical ....>

There's a thread about composing the shadow dom that this relates to...but that was getting long already so I'm posting here.
Any takers? :)

Scott Miles

unread,
Jul 18, 2014, 3:30:16 PM7/18/14
to Chris Gallo, polymer-dev
Where to draw the line on encapsulation is a contentious issue,  we tend to the line away from isolation, but there are inevitable costs. 

IMO, this idea goes too far toward exposing element internals. The notion today is that the element author should expose those configuration points as properties and map them to the shadow-dom internals as appropriate.


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/2d4977b9-6576-4838-a0ea-41378b8a3e2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rob Dodson

unread,
Jul 18, 2014, 3:41:14 PM7/18/14
to Scott Miles, Chris Gallo, polymer-dev
btw I noticed you were referencing core-icon. Just want to point out that core-icon is being updated so it can be sized with css. Currently on master you can do:

paper-button::shadow core-icon {
  width: 56px;
  height: 56px;
}



Chris Gallo

unread,
Jul 18, 2014, 4:13:31 PM7/18/14
to polym...@googlegroups.com, sjm...@google.com, gall...@gmail.com
Hi Rob, I noticed that change...but it doesn't appear to be working for paper-menu-button.
I'm having to resort to a 2x transform. Maybe I'm looking at a stale version, but I just updated yesterday. I'll take a deeper looker soon.
Nice videos by the way, great stuff! Thank you!

Chris Gallo

unread,
Jul 18, 2014, 4:23:08 PM7/18/14
to polym...@googlegroups.com, gall...@gmail.com
Scott I definitely see what you're saying. I guess I'm a little impatient/ADD when it comes to wanting to modify component internals.
If there's something simple missing from a component, I want to just stick a property on the consumer and 'bam' there it is, instead of having to potentially clone, update, pull request, etc. 
But on a philosophical note, it seems like theres potentially a lot of boilerplate that could develop, as often times we're just exposing properties and mapping them right back onto the inner element in question. The inner element then becomes full of bindings. By having some kind of external addressing mechanism, we could eliminate that boilerplate and keep the inner implementation cleaner. 

Rob Dodson

unread,
Jul 18, 2014, 4:44:58 PM7/18/14
to Chris Gallo, polymer-dev, Scott Miles
On Fri, Jul 18, 2014 at 1:13 PM, Chris Gallo <gall...@gmail.com> wrote:
Hi Rob, I noticed that change...but it doesn't appear to be working for paper-menu-button.
I'm having to resort to a 2x transform. Maybe I'm looking at a stale version, but I just updated yesterday. I'll take a deeper looker soon.

It's only on the master branch so you'd have to do a `bower cache clean` and set your dependency to:

"paper-menu-button": "Polymer/paper-menu-button#master"

Or hold out for the next release :)
 

Scott Miles

unread,
Jul 18, 2014, 6:55:54 PM7/18/14
to Chris Gallo, polymer-dev
Fwiw, I fundamentally agree with you. Enabling the developer staring at a problem to fix it directly drives a lot of design decisions around Polymer.

However, direct access mechanisms make it harder to change the internals of an element without breaking lots of existing code. This tension between maintenance and access is what provokes stronger notions of encapsulation. 

As a practical matter, we have to have a contract between component and component-user that balance bug-fixing and API breakage.

Scott

Reply all
Reply to author
Forward
0 new messages