polymer-core-rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +82 -0
- data/Rakefile +2 -0
- data/app/assets/components/core-ajax/core-ajax.html.erb +320 -0
- data/app/assets/components/core-ajax/core-xhr.html.erb +112 -0
- data/app/assets/components/core-animated-pages/core-animated-pages.css +18 -0
- data/app/assets/components/core-animated-pages/core-animated-pages.html.erb +413 -0
- data/app/assets/components/core-animated-pages/transitions/cascade-transition.html +138 -0
- data/app/assets/components/core-animated-pages/transitions/core-transition-pages.html.erb +173 -0
- data/app/assets/components/core-animated-pages/transitions/cross-fade.html.erb +173 -0
- data/app/assets/components/core-animated-pages/transitions/hero-transition.css +12 -0
- data/app/assets/components/core-animated-pages/transitions/hero-transition.html.erb +267 -0
- data/app/assets/components/core-animated-pages/transitions/list-cascade.html +58 -0
- data/app/assets/components/core-animated-pages/transitions/scale-up.html +37 -0
- data/app/assets/components/core-animated-pages/transitions/slide-down.html +55 -0
- data/app/assets/components/core-animated-pages/transitions/slide-from-bottom.html +31 -0
- data/app/assets/components/core-animated-pages/transitions/slide-from-right.html +35 -0
- data/app/assets/components/core-animated-pages/transitions/slide-up.html +82 -0
- data/app/assets/components/core-animated-pages/transitions/tile-cascade.html +101 -0
- data/app/assets/components/core-animation/core-animation-group.html.erb +168 -0
- data/app/assets/components/core-animation/core-animation.html.erb +523 -0
- data/app/assets/components/core-animation/web-animations.html.erb +1 -0
- data/app/assets/components/core-collapse/core-collapse.css +16 -0
- data/app/assets/components/core-collapse/core-collapse.html.erb +247 -0
- data/app/assets/components/core-drag-drop/core-drag-drop.html +109 -0
- data/app/assets/components/core-drawer-panel/core-drawer-panel.css +162 -0
- data/app/assets/components/core-drawer-panel/core-drawer-panel.html.erb +150 -0
- data/app/assets/components/core-field/core-field.css +38 -0
- data/app/assets/components/core-field/core-field.html.erb +32 -0
- data/app/assets/components/core-header-panel/core-header-panel.css +75 -0
- data/app/assets/components/core-header-panel/core-header-panel.html.erb +196 -0
- data/app/assets/components/core-icon/core-icon.css +25 -0
- data/app/assets/components/core-icon/core-icon.html.erb +126 -0
- data/app/assets/components/core-icon-button/core-icon-button.css +70 -0
- data/app/assets/components/core-icon-button/core-icon-button.html.erb +83 -0
- data/app/assets/components/core-icons/core-icons.html +14 -0
- data/app/assets/components/core-iconset/core-iconset.html.erb +236 -0
- data/app/assets/components/core-iconset-svg/core-iconset-svg.html +170 -0
- data/app/assets/components/core-input/core-input.css +35 -0
- data/app/assets/components/core-input/core-input.html.erb +311 -0
- data/app/assets/components/core-item/core-item.css +31 -0
- data/app/assets/components/core-item/core-item.html.erb +80 -0
- data/app/assets/components/core-list/core-list.css +20 -0
- data/app/assets/components/core-list/core-list.html.erb +403 -0
- data/app/assets/components/core-localstorage/core-localstorage.html +126 -0
- data/app/assets/components/core-media-query/core-media-query.html +86 -0
- data/app/assets/components/core-menu/core-menu.css +18 -0
- data/app/assets/components/core-menu/core-menu.html.erb +62 -0
- data/app/assets/components/core-menu/core-submenu.css +29 -0
- data/app/assets/components/core-menu/core-submenu.html.erb +106 -0
- data/app/assets/components/core-menu-button/core-menu-button.css +10 -0
- data/app/assets/components/core-menu-button/core-menu-button.html.erb +139 -0
- data/app/assets/components/core-meta/core-meta.html +143 -0
- data/app/assets/components/core-overlay/core-key-helper.html +17 -0
- data/app/assets/components/core-overlay/core-overlay-layer.html +112 -0
- data/app/assets/components/core-overlay/core-overlay.html.erb +661 -0
- data/app/assets/components/core-pages/core-pages.css +30 -0
- data/app/assets/components/core-pages/core-pages.html.erb +43 -0
- data/app/assets/components/core-range/core-range.html +107 -0
- data/app/assets/components/core-scaffold/core-scaffold.html.erb +147 -0
- data/app/assets/components/core-scroll-header-panel/core-scroll-header-panel.css +57 -0
- data/app/assets/components/core-scroll-header-panel/core-scroll-header-panel.html.erb +257 -0
- data/app/assets/components/core-selection/core-selection.html +148 -0
- data/app/assets/components/core-selector/core-selector.html.erb +423 -0
- data/app/assets/components/core-shared-lib/core-shared-lib.html +150 -0
- data/app/assets/components/core-signals/core-signals.html +83 -0
- data/app/assets/components/core-splitter/core-splitter.css.erb +27 -0
- data/app/assets/components/core-splitter/core-splitter.html.erb +159 -0
- data/app/assets/components/core-splitter/handle-h.svg +4 -0
- data/app/assets/components/core-splitter/handle.svg +4 -0
- data/app/assets/components/core-style/core-style.html +385 -0
- data/app/assets/components/core-toolbar/core-toolbar.css +126 -0
- data/app/assets/components/core-toolbar/core-toolbar.html.erb +73 -0
- data/app/assets/components/core-tooltip/core-tooltip.css +103 -0
- data/app/assets/components/core-tooltip/core-tooltip.html.erb +144 -0
- data/app/assets/components/core-transition/core-transition-css.html.erb +76 -0
- data/app/assets/components/core-transition/core-transition-overlay.css +46 -0
- data/app/assets/components/core-transition/core-transition.html.erb +44 -0
- data/app/assets/components/web-animations-js/web-animations.js +5666 -0
- data/lib/polymer-core-rails/engine.rb +4 -0
- data/lib/polymer-core-rails/version.rb +3 -0
- data/lib/polymer-core-rails.rb +2 -0
- metadata +167 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
<!--
|
2
|
+
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
3
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
4
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
5
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
6
|
+
Code distributed by Google as part of the polymer project is also
|
7
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
8
|
+
-->
|
9
|
+
|
10
|
+
<!--
|
11
|
+
The `core-field` supplies a horizontal layout, anticipating an input.
|
12
|
+
|
13
|
+
Example:
|
14
|
+
|
15
|
+
<core-field>
|
16
|
+
<core-icon icon="menu" size="48"></core-icon>
|
17
|
+
<label>I'm a label!</label>
|
18
|
+
<input placeholder="I have a label" flex>
|
19
|
+
</core-field>
|
20
|
+
|
21
|
+
@group Polymer Core Elements
|
22
|
+
@element core-field
|
23
|
+
@homepage github.io
|
24
|
+
-->
|
25
|
+
<polymer-element name="core-field" noscript center horizontal layout>
|
26
|
+
<template>
|
27
|
+
<%= stylesheet_link_tag "core-field/core-field" %>
|
28
|
+
|
29
|
+
<content select="*"></content>
|
30
|
+
|
31
|
+
</template>
|
32
|
+
</polymer-element>
|
@@ -0,0 +1,75 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
3
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
4
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
5
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
6
|
+
Code distributed by Google as part of the polymer project is also
|
7
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
8
|
+
*/
|
9
|
+
|
10
|
+
:host {
|
11
|
+
display: block;
|
12
|
+
position: relative;
|
13
|
+
}
|
14
|
+
|
15
|
+
#outerContainer {
|
16
|
+
position: absolute;
|
17
|
+
top: 0;
|
18
|
+
right: 0;
|
19
|
+
bottom: 0;
|
20
|
+
left: 0;
|
21
|
+
overflow-y: auto;
|
22
|
+
overflow-x: hidden;
|
23
|
+
-webkit-overflow-scrolling: touch;
|
24
|
+
}
|
25
|
+
|
26
|
+
#mainPanel {
|
27
|
+
position: relative;
|
28
|
+
}
|
29
|
+
|
30
|
+
#mainContainer {
|
31
|
+
position: relative;
|
32
|
+
overflow-y: auto;
|
33
|
+
overflow-x: hidden;
|
34
|
+
-webkit-overflow-scrolling: touch;
|
35
|
+
}
|
36
|
+
|
37
|
+
#dropShadow {
|
38
|
+
position: absolute;
|
39
|
+
top: 0;
|
40
|
+
left: 0;
|
41
|
+
right: 0;
|
42
|
+
height: 6px;
|
43
|
+
box-shadow: inset 0px 5px 6px -3px rgba(0, 0, 0, 0.4);
|
44
|
+
}
|
45
|
+
|
46
|
+
#dropShadow.hidden {
|
47
|
+
display: none;
|
48
|
+
}
|
49
|
+
|
50
|
+
/*
|
51
|
+
mode: scroll
|
52
|
+
*/
|
53
|
+
:host([mode=scroll]) #mainContainer {
|
54
|
+
overflow: visible;
|
55
|
+
}
|
56
|
+
|
57
|
+
/*
|
58
|
+
mode: cover
|
59
|
+
*/
|
60
|
+
:host([mode=cover]) #mainPanel {
|
61
|
+
position: static;
|
62
|
+
}
|
63
|
+
|
64
|
+
:host([mode=cover]) #mainContainer {
|
65
|
+
position: absolute;
|
66
|
+
top: 0;
|
67
|
+
right: 0;
|
68
|
+
bottom: 0;
|
69
|
+
left: 0;
|
70
|
+
}
|
71
|
+
|
72
|
+
:host([mode=cover]) #dropShadow {
|
73
|
+
position: static;
|
74
|
+
width: 100%;
|
75
|
+
}
|
@@ -0,0 +1,196 @@
|
|
1
|
+
<!--
|
2
|
+
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
3
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
4
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
5
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
6
|
+
Code distributed by Google as part of the polymer project is also
|
7
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
8
|
+
-->
|
9
|
+
|
10
|
+
<!--
|
11
|
+
`core-header-panel` contains a header section and a content panel section.
|
12
|
+
|
13
|
+
__Important:__ The `core-header-panel` will not display if its parent does not have a height.
|
14
|
+
|
15
|
+
Using [layout attributes](http://www.polymer-project.org/docs/polymer/layout-attrs.html), you can easily make the `core-header-panel` fill the screen
|
16
|
+
|
17
|
+
<body fullbleed layout vertical>
|
18
|
+
<core-header-panel flex>
|
19
|
+
<core-toolbar>
|
20
|
+
<div>Hello World!</div>
|
21
|
+
</core-toolbar>
|
22
|
+
</core-header-panel>
|
23
|
+
</body>
|
24
|
+
|
25
|
+
or, if you would prefer to do it in CSS, just give `html`, `body`, and `core-header-panel` a height of 100%:
|
26
|
+
|
27
|
+
html, body {
|
28
|
+
height: 100%;
|
29
|
+
margin: 0;
|
30
|
+
}
|
31
|
+
core-header-panel {
|
32
|
+
height: 100%;
|
33
|
+
}
|
34
|
+
|
35
|
+
Special
|
36
|
+
support is provided for scrolling modes when one uses a core-toolbar or equivalent
|
37
|
+
for the header section.
|
38
|
+
|
39
|
+
Example:
|
40
|
+
|
41
|
+
<core-header-panel>
|
42
|
+
<core-toolbar>Header</core-toolbar>
|
43
|
+
<div>Content goes here...</div>
|
44
|
+
</core-header-panel>
|
45
|
+
|
46
|
+
If you want to use other than `core-toolbar` for the header, add
|
47
|
+
`core-header` class to that element.
|
48
|
+
|
49
|
+
Example:
|
50
|
+
|
51
|
+
<core-header-panel>
|
52
|
+
<div class="core-header">Header</div>
|
53
|
+
<div>Content goes here...</div>
|
54
|
+
</core-header-panel>
|
55
|
+
|
56
|
+
Use `mode` to control the header and scrolling behavior.
|
57
|
+
|
58
|
+
@group Polymer Core Elements
|
59
|
+
@element core-header-panel
|
60
|
+
@homepage github.io
|
61
|
+
-->
|
62
|
+
|
63
|
+
|
64
|
+
<polymer-element name="core-header-panel">
|
65
|
+
<template>
|
66
|
+
|
67
|
+
<%= stylesheet_link_tag "core-header-panel/core-header-panel" %>
|
68
|
+
|
69
|
+
<div id="outerContainer" on-scroll="{{scroll}}" vertical layout>
|
70
|
+
|
71
|
+
<content id="headerContent" select="core-toolbar, .core-header"></content>
|
72
|
+
|
73
|
+
<div id="mainPanel" flex vertical layout>
|
74
|
+
|
75
|
+
<div id="mainContainer" flex?="{{mode !== 'cover'}}" on-scroll="{{scroll}}">
|
76
|
+
<content id="mainContent" select="*"></content>
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="dropShadow"></div>
|
80
|
+
|
81
|
+
</div>
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
</template>
|
86
|
+
<script>
|
87
|
+
|
88
|
+
Polymer('core-header-panel', {
|
89
|
+
|
90
|
+
publish: {
|
91
|
+
/**
|
92
|
+
* Controls header and scrolling behavior. Options are
|
93
|
+
* `standard`, `seamed`, `waterfall`, `waterfall-tall`,
|
94
|
+
* `waterfall-medium-tall`, `scroll` and `cover`.
|
95
|
+
* Default is `standard`.
|
96
|
+
*
|
97
|
+
* `standard`: The header is a step above the panel. The header will consume the
|
98
|
+
* panel at the point of entry, preventing it from passing through to the
|
99
|
+
* opposite side.
|
100
|
+
*
|
101
|
+
* `seamed`: The header is presented as seamed with the panel.
|
102
|
+
*
|
103
|
+
* `waterfall`: Similar to standard mode, but header is initially presented as
|
104
|
+
* seamed with panel, but then separates to form the step.
|
105
|
+
*
|
106
|
+
* `waterfall-tall`: The header is initially taller (`tall` class is added to
|
107
|
+
* the header). As the user scrolls, the header separates (forming an edge)
|
108
|
+
* while condensing (`tall` class is removed from the header).
|
109
|
+
*
|
110
|
+
* `scroll`: The header keeps its seam with the panel, and is pushed off screen.
|
111
|
+
*
|
112
|
+
* `cover`: The panel covers the whole `core-header-panel` including the
|
113
|
+
* header. This allows user to style the panel in such a way that the panel is
|
114
|
+
* partially covering the header.
|
115
|
+
*
|
116
|
+
* <style>
|
117
|
+
* core-header-panel[mode=cover]::shadow #mainContainer {
|
118
|
+
* left: 80px;
|
119
|
+
* }
|
120
|
+
* .content {
|
121
|
+
* margin: 60px 60px 60px 0;
|
122
|
+
* }
|
123
|
+
* </style>
|
124
|
+
*
|
125
|
+
* <core-header-panel mode="cover">
|
126
|
+
* <core-appbar class="tall">
|
127
|
+
* <core-icon-button icon="menu"></core-icon-button>
|
128
|
+
* </core-appbar>
|
129
|
+
* <div class="content"></div>
|
130
|
+
* </core-header-panel>
|
131
|
+
*
|
132
|
+
* @attribute mode
|
133
|
+
* @type string
|
134
|
+
* @default ''
|
135
|
+
*/
|
136
|
+
mode: {value: '', reflect: true},
|
137
|
+
|
138
|
+
/**
|
139
|
+
* The class used in waterfall-tall mode. Change this if the header
|
140
|
+
* accepts a different class for toggling height, e.g. "medium-tall"
|
141
|
+
*
|
142
|
+
* @attribute tallClass
|
143
|
+
* @type string
|
144
|
+
* @default 'tall'
|
145
|
+
*/
|
146
|
+
tallClass: 'tall',
|
147
|
+
|
148
|
+
/**
|
149
|
+
* If true, the drop-shadow is always shown no matter what mode is set to.
|
150
|
+
*
|
151
|
+
* @attribute shadow
|
152
|
+
* @type boolean
|
153
|
+
* @default false
|
154
|
+
*/
|
155
|
+
shadow: false,
|
156
|
+
},
|
157
|
+
|
158
|
+
domReady: function() {
|
159
|
+
this.async('scroll');
|
160
|
+
},
|
161
|
+
|
162
|
+
modeChanged: function() {
|
163
|
+
this.scroll();
|
164
|
+
},
|
165
|
+
|
166
|
+
get header() {
|
167
|
+
return this.$.headerContent.getDistributedNodes()[0];
|
168
|
+
},
|
169
|
+
|
170
|
+
scroll: function() {
|
171
|
+
var shadowMode = {'waterfall': 1, 'waterfall-tall': 1};
|
172
|
+
var noShadow = {'seamed': 1, 'cover': 1, 'scroll': 1};
|
173
|
+
var tallMode = {'waterfall-tall': 1};
|
174
|
+
|
175
|
+
var main = this.$.mainContainer;
|
176
|
+
var header = this.header;
|
177
|
+
|
178
|
+
var sTop = main.scrollTop;
|
179
|
+
var atTop = sTop === 0;
|
180
|
+
|
181
|
+
if (header) {
|
182
|
+
this.$.dropShadow.classList.toggle('hidden', !this.shadow &&
|
183
|
+
(atTop && shadowMode[this.mode] || noShadow[this.mode]));
|
184
|
+
|
185
|
+
if (tallMode[this.mode]) {
|
186
|
+
header.classList.toggle(this.tallClass, atTop);
|
187
|
+
}
|
188
|
+
|
189
|
+
header.classList.toggle('animate', tallMode[this.mode]);
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
});
|
194
|
+
|
195
|
+
</script>
|
196
|
+
</polymer-element>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
/* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
2
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
3
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
4
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
5
|
+
Code distributed by Google as part of the polymer project is also
|
6
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */
|
7
|
+
|
8
|
+
html /deep/ core-icon {
|
9
|
+
display: inline-block;
|
10
|
+
vertical-align: middle;
|
11
|
+
background-repeat: no-repeat;
|
12
|
+
fill: currentcolor;
|
13
|
+
}
|
14
|
+
|
15
|
+
html /deep/ core-icon[size=""] {
|
16
|
+
position: relative;
|
17
|
+
}
|
18
|
+
|
19
|
+
html /deep/ core-icon[size=""] > svg {
|
20
|
+
position: absolute;
|
21
|
+
top: 0;
|
22
|
+
right: 0;
|
23
|
+
bottom: 0;
|
24
|
+
left: 0;
|
25
|
+
}
|
@@ -0,0 +1,126 @@
|
|
1
|
+
<!--
|
2
|
+
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
3
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
4
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
5
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
6
|
+
Code distributed by Google as part of the polymer project is also
|
7
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
8
|
+
-->
|
9
|
+
<!--
|
10
|
+
|
11
|
+
The `core-icon` element displays an icon using CSS background image. By default an icon renders as 24px square.
|
12
|
+
|
13
|
+
Example using src:
|
14
|
+
|
15
|
+
<core-icon src="star.png"></core-icon>
|
16
|
+
|
17
|
+
Example setting size to 32px x 32px:
|
18
|
+
|
19
|
+
<core-icon src="big_star.png" size="32"></core-icon>
|
20
|
+
|
21
|
+
Example using icon from default iconset:
|
22
|
+
|
23
|
+
<core-icon icon="menu"></core-icon>
|
24
|
+
|
25
|
+
Example using icon `cherry` from custom iconset `fruit`:
|
26
|
+
|
27
|
+
<core-icon icon="fruit:cherry"></core-icon>
|
28
|
+
|
29
|
+
See [core-iconset](#core-iconset) and [core-iconset-svg](#core-iconset-svg) for more information about
|
30
|
+
how to use a custom iconset.
|
31
|
+
|
32
|
+
See [core-icons](http://www.polymer-project.org/components/core-icons/demo.html) for the default set of icons. To use the default set of icons you'll need to include an import for `core-icons.html`.
|
33
|
+
|
34
|
+
@group Polymer Core Elements
|
35
|
+
@element core-icon
|
36
|
+
@homepage polymer.github.io
|
37
|
+
-->
|
38
|
+
<%= html_import_tag "core-iconset/core-iconset" %>
|
39
|
+
|
40
|
+
<%= stylesheet_link_tag "core-icon/core-icon"%>
|
41
|
+
|
42
|
+
|
43
|
+
<polymer-element name="core-icon" attributes="src size icon">
|
44
|
+
<script>
|
45
|
+
(function() {
|
46
|
+
|
47
|
+
// mono-state
|
48
|
+
var meta;
|
49
|
+
|
50
|
+
Polymer('core-icon', {
|
51
|
+
|
52
|
+
/**
|
53
|
+
* The URL of an image for the icon. If the src property is specified,
|
54
|
+
* the icon property should not be.
|
55
|
+
*
|
56
|
+
* @attribute src
|
57
|
+
* @type string
|
58
|
+
* @default ''
|
59
|
+
*/
|
60
|
+
src: '',
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Specifies the size of the icon in pixel units.
|
64
|
+
*
|
65
|
+
* @attribute size
|
66
|
+
* @type string
|
67
|
+
* @default 24
|
68
|
+
*/
|
69
|
+
size: 24,
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Specifies the icon name or index in the set of icons available in
|
73
|
+
* the icon's icon set. If the icon property is specified,
|
74
|
+
* the src property should not be.
|
75
|
+
*
|
76
|
+
* @attribute icon
|
77
|
+
* @type string
|
78
|
+
* @default ''
|
79
|
+
*/
|
80
|
+
icon: '',
|
81
|
+
|
82
|
+
observe: {
|
83
|
+
'size icon': 'updateIcon'
|
84
|
+
},
|
85
|
+
|
86
|
+
defaultIconset: 'icons',
|
87
|
+
|
88
|
+
ready: function() {
|
89
|
+
if (!meta) {
|
90
|
+
meta = document.createElement('core-iconset');
|
91
|
+
}
|
92
|
+
this.updateIcon();
|
93
|
+
},
|
94
|
+
|
95
|
+
srcChanged: function() {
|
96
|
+
this.style.backgroundImage = 'url(' + this.src + ')';
|
97
|
+
this.style.backgroundPosition = 'center';
|
98
|
+
this.style.backgroundSize = this.size + 'px ' + this.size + 'px';
|
99
|
+
},
|
100
|
+
|
101
|
+
getIconset: function(name) {
|
102
|
+
return meta.byId(name || this.defaultIconset);
|
103
|
+
},
|
104
|
+
|
105
|
+
updateIcon: function() {
|
106
|
+
if (this.size) {
|
107
|
+
this.style.width = this.style.height = this.size + 'px';
|
108
|
+
}
|
109
|
+
if (this.icon) {
|
110
|
+
var parts = String(this.icon).split(':');
|
111
|
+
var icon = parts.pop();
|
112
|
+
if (icon) {
|
113
|
+
var set = this.getIconset(parts.pop());
|
114
|
+
if (set) {
|
115
|
+
set.applyIcon(this, icon, this.size / set.iconSize);
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
});
|
122
|
+
|
123
|
+
})();
|
124
|
+
</script>
|
125
|
+
|
126
|
+
</polymer-element>
|
@@ -0,0 +1,70 @@
|
|
1
|
+
/*
|
2
|
+
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
3
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
|
4
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS
|
5
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
|
6
|
+
Code distributed by Google as part of the polymer project is also
|
7
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
|
8
|
+
*/
|
9
|
+
|
10
|
+
:host {
|
11
|
+
display: inline-block;
|
12
|
+
box-sizing: border-box;
|
13
|
+
-moz-box-sizing: border-box;
|
14
|
+
width: 38px;
|
15
|
+
height: 38px;
|
16
|
+
background-image: none;
|
17
|
+
border-radius: 2px;
|
18
|
+
padding: 7px;
|
19
|
+
margin: 2px;
|
20
|
+
vertical-align: middle;
|
21
|
+
font-size: 1rem;
|
22
|
+
cursor: pointer;
|
23
|
+
}
|
24
|
+
|
25
|
+
:host([disabled]) {
|
26
|
+
opacity: 0.6;
|
27
|
+
pointer-events: none;
|
28
|
+
}
|
29
|
+
|
30
|
+
:host(.outline) {
|
31
|
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
|
32
|
+
}
|
33
|
+
|
34
|
+
:host(:hover:not([disabled])) {
|
35
|
+
box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.1);
|
36
|
+
}
|
37
|
+
|
38
|
+
:host(.selected:not([disabled])) {
|
39
|
+
background-color: rgba(0, 0, 0, 0.05);
|
40
|
+
box-shadow: inset 0 1px 0 0 rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.12);
|
41
|
+
}
|
42
|
+
|
43
|
+
:host(:active:not([disabled]), .selected:active:not([disabled])) {
|
44
|
+
background-color: rgba(0, 0, 0, 0.05);
|
45
|
+
box-shadow: inset 0 1px 0 0 rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.12);
|
46
|
+
}
|
47
|
+
|
48
|
+
:host(.core-dark-theme.outline) {
|
49
|
+
background-color: rgba(200, 200, 200, 0.05);
|
50
|
+
box-shadow: 0 0 0 1px rgba(200, 200, 200, 0.1);
|
51
|
+
}
|
52
|
+
|
53
|
+
:host(.core-dark-theme:hover) {
|
54
|
+
background-color: rgba(200, 200, 200, 0.05);
|
55
|
+
box-shadow: 0 1px 0 0 rgba(200, 200, 200, 0.12), 0 0 0 1px rgba(200, 200, 200, 0.1);
|
56
|
+
}
|
57
|
+
|
58
|
+
:host(.core-dark-theme.selected) {
|
59
|
+
background-color: rgba(220, 220, 220, 0.05);
|
60
|
+
box-shadow: inset 0 1px 0 0 rgba(200, 200, 200, 0.05), 0 0 0 1px rgba(200, 200, 200, 0.12);
|
61
|
+
}
|
62
|
+
|
63
|
+
:host(.core-dark-theme:active, .core-dark-theme.selected:active) {
|
64
|
+
background-color: rgba(200, 200, 200, 0.05);
|
65
|
+
box-shadow: inset 0 1px 0 0 rgba(200, 200, 200, 0.1), 0 0 0 1px rgba(200, 200, 200, 0.12);
|
66
|
+
}
|
67
|
+
|
68
|
+
core-icon {
|
69
|
+
pointer-events: none;
|
70
|
+
}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
<!--
|
2
|
+
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
3
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
4
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
5
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
6
|
+
Code distributed by Google as part of the polymer project is also
|
7
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
8
|
+
-->
|
9
|
+
|
10
|
+
<!--
|
11
|
+
`core-icon-button` is an icon with button behaviors.
|
12
|
+
|
13
|
+
<core-icon-button src="star.png"></core-icon-button>
|
14
|
+
|
15
|
+
`core-icon-button` includes a default icon set. Use `icon` to specify
|
16
|
+
which icon from the icon set to use.
|
17
|
+
|
18
|
+
<core-icon-button icon="menu"></core-icon-button>
|
19
|
+
|
20
|
+
See [`core-iconset`](#core-iconset) for more information about
|
21
|
+
how to use a custom icon set.
|
22
|
+
|
23
|
+
@group Polymer Core Elements
|
24
|
+
@element core-icon-button
|
25
|
+
@homepage github.io
|
26
|
+
-->
|
27
|
+
|
28
|
+
<%= html_import_tag "core-icon/core-icon" %>
|
29
|
+
<%= html_import_tag "core-icons/core-icons" %>
|
30
|
+
|
31
|
+
<polymer-element name="core-icon-button" attributes="src icon active">
|
32
|
+
|
33
|
+
<template>
|
34
|
+
<%= stylesheet_link_tag "core-icon-button/core-icon-button"%>
|
35
|
+
|
36
|
+
<core-icon src="{{src}}" icon="{{icon}}"><content></content></core-icon>
|
37
|
+
|
38
|
+
</template>
|
39
|
+
|
40
|
+
<script>
|
41
|
+
|
42
|
+
Polymer('core-icon-button', {
|
43
|
+
|
44
|
+
/**
|
45
|
+
* The URL of an image for the icon. Should not use `icon` property
|
46
|
+
* if you are using this property.
|
47
|
+
*
|
48
|
+
* @attribute src
|
49
|
+
* @type string
|
50
|
+
* @default ''
|
51
|
+
*/
|
52
|
+
src: '',
|
53
|
+
|
54
|
+
/**
|
55
|
+
* If true, border is placed around the button to indicate it's
|
56
|
+
* active state.
|
57
|
+
*
|
58
|
+
* @attribute active
|
59
|
+
* @type boolean
|
60
|
+
* @default false
|
61
|
+
*/
|
62
|
+
active: false,
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Specifies the icon name or index in the set of icons available in
|
66
|
+
* the icon set. Should not use `src` property if you are using this
|
67
|
+
* property.
|
68
|
+
*
|
69
|
+
* @attribute icon
|
70
|
+
* @type string
|
71
|
+
* @default ''
|
72
|
+
*/
|
73
|
+
icon: '',
|
74
|
+
|
75
|
+
activeChanged: function() {
|
76
|
+
this.classList.toggle('selected', this.active);
|
77
|
+
}
|
78
|
+
|
79
|
+
});
|
80
|
+
|
81
|
+
</script>
|
82
|
+
|
83
|
+
</polymer-element>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!--
|
2
|
+
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
3
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
4
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
5
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
6
|
+
Code distributed by Google as part of the polymer project is also
|
7
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
8
|
+
-->
|
9
|
+
<!-- import core-icon for convenience
|
10
|
+
TODO(sorvell): we'd rather do this in core-iconset but we can't until
|
11
|
+
crbug.com/373461 is addressed
|
12
|
+
-->
|
13
|
+
<%= html_import_tag "core-icons/core-icons" %>
|
14
|
+
<%= html_import_tag "core-iconset-svg/core-iconset-svg" %>
|