Are there guidelines on the best way to extend core elements like core-item in Polymer?
For example, I wanted to extend core-item with a paper-ripple ("Ripple All The Things!") and it seems like the options are to either extend core-item or compose a new element including it. Extending seems to lose styling of core-item, and Composing means I need to map all the attributes:
Extend core-item:
<polymer-element name="my-item" extends="core-item" noscript>
<template>
<paper-ripple fit></paper-ripple>
<shadow></shadow>
</template>
</polymer-element>
This has the unfortunate side effect that the CSS defined in core-item.css nolonger matches for all the 'html /deep/ core-item' rules and I lose the padding around the icon, etc, unless I manually go set it up again in my-item. I need to go into my-item and attempt to style it match the work done in core-item.css, either matching to 'my-item' or maybe just on the :host? This seems like a bunch of extra copy/paste :
<style>
:host {
display: block;
position: relative;
height: 40px;
white-space: nowrap;
}
:host(.core-selected) {
font-weight: bold;
}
:host::shadow core-icon {
margin: 0 16px 0 4px;
}
:host::shadow ::content > a {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
</style>
Or compose a new my-item:
<polymer-element name="my-item" attributes="label icon src" noscript>
<template>
<core-item src="{{src}}" icon="{{icon}}" label="{{label}}">
<paper-ripple fit></paper-ripple>
</core-item>
</template>
</polymer-element>
This works great, though I then need to map all the attributes of core-item to my published attributes. Not that bad, but it feels like there may be a better way, particularly for more complicated components?