polymer-paper-elements-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +51 -0
  3. data/Rakefile +1 -0
  4. data/app/assets/components/iron-a11y-announcer/iron-a11y-announcer.html +125 -0
  5. data/app/assets/components/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html +418 -0
  6. data/app/assets/components/iron-autogrow-textarea/hero.svg +33 -0
  7. data/app/assets/components/iron-autogrow-textarea/iron-autogrow-textarea.html +263 -0
  8. data/app/assets/components/iron-behaviors/iron-button-state.html +195 -0
  9. data/app/assets/components/iron-behaviors/iron-control-state.html +102 -0
  10. data/app/assets/components/iron-fit-behavior/iron-fit-behavior.html +230 -0
  11. data/app/assets/components/iron-flex-layout/classes/iron-flex-layout.html +307 -0
  12. data/app/assets/components/iron-flex-layout/classes/iron-shadow-flex-layout.html +302 -0
  13. data/app/assets/components/iron-flex-layout/iron-flex-layout.html +313 -0
  14. data/app/assets/components/iron-form-element-behavior/iron-form-element-behavior.html +50 -0
  15. data/app/assets/components/iron-icon/hero.svg +19 -0
  16. data/app/assets/components/iron-icon/iron-icon.html +187 -0
  17. data/app/assets/components/iron-icons/av-icons.html +73 -0
  18. data/app/assets/components/iron-icons/communication-icons.html +59 -0
  19. data/app/assets/components/iron-icons/device-icons.html +94 -0
  20. data/app/assets/components/iron-icons/editor-icons.html +70 -0
  21. data/app/assets/components/iron-icons/hardware-icons.html +61 -0
  22. data/app/assets/components/iron-icons/hero.svg +35 -0
  23. data/app/assets/components/iron-icons/image-icons.html +164 -0
  24. data/app/assets/components/iron-icons/iron-icons.html +303 -0
  25. data/app/assets/components/iron-icons/maps-icons.html +71 -0
  26. data/app/assets/components/iron-icons/notification-icons.html +62 -0
  27. data/app/assets/components/iron-icons/social-icons.html +40 -0
  28. data/app/assets/components/iron-iconset-svg/iron-iconset-svg.html +191 -0
  29. data/app/assets/components/iron-input/hero.svg +19 -0
  30. data/app/assets/components/iron-input/iron-input.html +235 -0
  31. data/app/assets/components/iron-media-query/hero.svg +29 -0
  32. data/app/assets/components/iron-media-query/iron-media-query.html +84 -0
  33. data/app/assets/components/iron-menu-behavior/iron-menu-behavior.html +214 -0
  34. data/app/assets/components/iron-menu-behavior/iron-menubar-behavior.html +65 -0
  35. data/app/assets/components/iron-meta/hero.svg +33 -0
  36. data/app/assets/components/iron-meta/iron-meta.html +352 -0
  37. data/app/assets/components/iron-overlay-behavior/iron-overlay-backdrop.html +132 -0
  38. data/app/assets/components/iron-overlay-behavior/iron-overlay-behavior.html +432 -0
  39. data/app/assets/components/iron-overlay-behavior/iron-overlay-manager.html +107 -0
  40. data/app/assets/components/iron-range-behavior/iron-range-behavior.html +101 -0
  41. data/app/assets/components/iron-resizable-behavior/iron-resizable-behavior.html +139 -0
  42. data/app/assets/components/iron-selector/iron-multi-selectable.html +120 -0
  43. data/app/assets/components/iron-selector/iron-selectable.html +307 -0
  44. data/app/assets/components/iron-selector/iron-selection.html +115 -0
  45. data/app/assets/components/iron-selector/iron-selector.html +71 -0
  46. data/app/assets/components/iron-validatable-behavior/iron-validatable-behavior.html +100 -0
  47. data/app/assets/components/neon-animation/animations/cascaded-animation.html +84 -0
  48. data/app/assets/components/neon-animation/animations/fade-in-animation.html +49 -0
  49. data/app/assets/components/neon-animation/animations/fade-out-animation.html +49 -0
  50. data/app/assets/components/neon-animation/animations/hero-animation.html +83 -0
  51. data/app/assets/components/neon-animation/animations/opaque-animation.html +46 -0
  52. data/app/assets/components/neon-animation/animations/ripple-animation.html +92 -0
  53. data/app/assets/components/neon-animation/animations/scale-down-animation.html +65 -0
  54. data/app/assets/components/neon-animation/animations/scale-up-animation.html +58 -0
  55. data/app/assets/components/neon-animation/animations/slide-down-animation.html +59 -0
  56. data/app/assets/components/neon-animation/animations/slide-from-left-animation.html +60 -0
  57. data/app/assets/components/neon-animation/animations/slide-from-right-animation.html +60 -0
  58. data/app/assets/components/neon-animation/animations/slide-left-animation.html +59 -0
  59. data/app/assets/components/neon-animation/animations/slide-right-animation.html +59 -0
  60. data/app/assets/components/neon-animation/animations/slide-up-animation.html +59 -0
  61. data/app/assets/components/neon-animation/animations/transform-animation.html +61 -0
  62. data/app/assets/components/neon-animation/guides/neon-animation.md +313 -0
  63. data/app/assets/components/neon-animation/neon-animatable-behavior.html +156 -0
  64. data/app/assets/components/neon-animation/neon-animatable.html +54 -0
  65. data/app/assets/components/neon-animation/neon-animated-pages.html +208 -0
  66. data/app/assets/components/neon-animation/neon-animation-behavior.html +88 -0
  67. data/app/assets/components/neon-animation/neon-animation-runner-behavior.html +110 -0
  68. data/app/assets/components/neon-animation/neon-animation.html +17 -0
  69. data/app/assets/components/neon-animation/neon-animations.html +25 -0
  70. data/app/assets/components/neon-animation/neon-shared-element-animatable-behavior.html +37 -0
  71. data/app/assets/components/neon-animation/neon-shared-element-animation-behavior.html +66 -0
  72. data/app/assets/components/neon-animation/web-animations.html +11 -0
  73. data/app/assets/components/paper-behaviors/paper-button-behavior.html +55 -0
  74. data/app/assets/components/paper-behaviors/paper-inky-focus-behavior.html +44 -0
  75. data/app/assets/components/paper-button/paper-button.html +177 -0
  76. data/app/assets/components/paper-checkbox/metadata.html +17 -0
  77. data/app/assets/components/paper-checkbox/paper-checkbox.css +149 -0
  78. data/app/assets/components/paper-checkbox/paper-checkbox.html +163 -0
  79. data/app/assets/components/paper-dialog-behavior/hero.svg +51 -0
  80. data/app/assets/components/paper-dialog-behavior/paper-dialog-behavior.html +236 -0
  81. data/app/assets/components/paper-dialog-behavior/paper-dialog-common.css +58 -0
  82. data/app/assets/components/paper-dialog-scrollable/hero.svg +69 -0
  83. data/app/assets/components/paper-dialog-scrollable/paper-dialog-scrollable.html +150 -0
  84. data/app/assets/components/paper-dialog/hero.svg +58 -0
  85. data/app/assets/components/paper-dialog/paper-dialog.html +122 -0
  86. data/app/assets/components/paper-drawer-panel/hero.svg +21 -0
  87. data/app/assets/components/paper-drawer-panel/paper-drawer-panel.css +142 -0
  88. data/app/assets/components/paper-drawer-panel/paper-drawer-panel.html +585 -0
  89. data/app/assets/components/paper-fab/paper-fab.html +159 -0
  90. data/app/assets/components/paper-header-panel/hero.svg +38 -0
  91. data/app/assets/components/paper-header-panel/paper-header-panel.html +496 -0
  92. data/app/assets/components/paper-icon-button/paper-icon-button.html +141 -0
  93. data/app/assets/components/paper-input/all-imports.html +12 -0
  94. data/app/assets/components/paper-input/hero.svg +19 -0
  95. data/app/assets/components/paper-input/paper-input-addon-behavior.html +43 -0
  96. data/app/assets/components/paper-input/paper-input-behavior.html +293 -0
  97. data/app/assets/components/paper-input/paper-input-char-counter.html +95 -0
  98. data/app/assets/components/paper-input/paper-input-container.html +495 -0
  99. data/app/assets/components/paper-input/paper-input-error.html +99 -0
  100. data/app/assets/components/paper-input/paper-input.html +126 -0
  101. data/app/assets/components/paper-input/paper-textarea.html +100 -0
  102. data/app/assets/components/paper-item/all-imports.html +13 -0
  103. data/app/assets/components/paper-item/paper-icon-item.html +86 -0
  104. data/app/assets/components/paper-item/paper-item-body.html +93 -0
  105. data/app/assets/components/paper-item/paper-item-shared.css +19 -0
  106. data/app/assets/components/paper-item/paper-item.html +95 -0
  107. data/app/assets/components/paper-material/paper-material.html +98 -0
  108. data/app/assets/components/paper-menu/hero.svg +35 -0
  109. data/app/assets/components/paper-menu/paper-menu.html +133 -0
  110. data/app/assets/components/paper-progress/hero.svg +21 -0
  111. data/app/assets/components/paper-progress/paper-progress.html +199 -0
  112. data/app/assets/components/paper-radio-button/hero.svg +22 -0
  113. data/app/assets/components/paper-radio-button/paper-radio-button.css +109 -0
  114. data/app/assets/components/paper-radio-button/paper-radio-button.html +148 -0
  115. data/app/assets/components/paper-radio-group/hero.svg +25 -0
  116. data/app/assets/components/paper-radio-group/paper-radio-group.html +186 -0
  117. data/app/assets/components/paper-ripple/hero.svg +30 -0
  118. data/app/assets/components/paper-ripple/paper-ripple.html +714 -0
  119. data/app/assets/components/paper-scroll-header-panel/hero.svg +41 -0
  120. data/app/assets/components/paper-scroll-header-panel/paper-scroll-header-panel.html +455 -0
  121. data/app/assets/components/paper-slider/hero.svg +20 -0
  122. data/app/assets/components/paper-slider/paper-slider.css +252 -0
  123. data/app/assets/components/paper-slider/paper-slider.html +449 -0
  124. data/app/assets/components/paper-spinner/hero.svg +27 -0
  125. data/app/assets/components/paper-spinner/paper-spinner.css +325 -0
  126. data/app/assets/components/paper-spinner/paper-spinner.html +222 -0
  127. data/app/assets/components/paper-styles/classes/global.html +96 -0
  128. data/app/assets/components/paper-styles/classes/shadow-layout.html +302 -0
  129. data/app/assets/components/paper-styles/classes/shadow.html +39 -0
  130. data/app/assets/components/paper-styles/classes/typography.html +171 -0
  131. data/app/assets/components/paper-styles/color.html +333 -0
  132. data/app/assets/components/paper-styles/default-theme.html +39 -0
  133. data/app/assets/components/paper-styles/paper-styles-classes.html +14 -0
  134. data/app/assets/components/paper-styles/paper-styles.html +17 -0
  135. data/app/assets/components/paper-styles/shadow.html +61 -0
  136. data/app/assets/components/paper-styles/typography.html +240 -0
  137. data/app/assets/components/paper-tabs/hero.svg +23 -0
  138. data/app/assets/components/paper-tabs/paper-tab.html +158 -0
  139. data/app/assets/components/paper-tabs/paper-tabs-icons.html +18 -0
  140. data/app/assets/components/paper-tabs/paper-tabs.html +483 -0
  141. data/app/assets/components/paper-toast/hero.svg +20 -0
  142. data/app/assets/components/paper-toast/paper-toast.html +164 -0
  143. data/app/assets/components/paper-toggle-button/hero.svg +22 -0
  144. data/app/assets/components/paper-toggle-button/paper-toggle-button.css +108 -0
  145. data/app/assets/components/paper-toggle-button/paper-toggle-button.html +183 -0
  146. data/app/assets/components/paper-toolbar/paper-toolbar.html +375 -0
  147. data/app/assets/components/polymer-gestures/Gruntfile.js +60 -0
  148. data/app/assets/components/polymer-gestures/banner.txt +9 -0
  149. data/app/assets/components/polymer-gestures/build.json +17 -0
  150. data/app/assets/components/polymer-gestures/conf/karma.conf.js +39 -0
  151. data/app/assets/components/polymer-gestures/package.json +20 -0
  152. data/app/assets/components/polymer-gestures/polymer-gestures.html +21 -0
  153. data/app/assets/components/polymer-gestures/polymer-gestures.js +46 -0
  154. data/app/assets/components/polymer-gestures/src/dispatcher.js +474 -0
  155. data/app/assets/components/polymer-gestures/src/eventFactory.js +127 -0
  156. data/app/assets/components/polymer-gestures/src/hold.js +129 -0
  157. data/app/assets/components/polymer-gestures/src/mouse.js +135 -0
  158. data/app/assets/components/polymer-gestures/src/ms.js +80 -0
  159. data/app/assets/components/polymer-gestures/src/pinch.js +186 -0
  160. data/app/assets/components/polymer-gestures/src/platform-events.js +39 -0
  161. data/app/assets/components/polymer-gestures/src/pointer.js +68 -0
  162. data/app/assets/components/polymer-gestures/src/pointermap.js +67 -0
  163. data/app/assets/components/polymer-gestures/src/scope.js +10 -0
  164. data/app/assets/components/polymer-gestures/src/tap.js +103 -0
  165. data/app/assets/components/polymer-gestures/src/targetfind.js +244 -0
  166. data/app/assets/components/polymer-gestures/src/touch-action.js +60 -0
  167. data/app/assets/components/polymer-gestures/src/touch.js +341 -0
  168. data/app/assets/components/polymer-gestures/src/track.js +230 -0
  169. data/app/assets/components/web-animations-js/web-animations-next-lite.min.js +17 -0
  170. data/app/assets/components/web-animations-js/web-animations-next.min.js +17 -0
  171. data/app/assets/components/web-animations-js/web-animations.min.js +17 -0
  172. data/app/assets/components/webcomponentsjs/CustomElements.js +956 -0
  173. data/app/assets/components/webcomponentsjs/CustomElements.min.js +11 -0
  174. data/app/assets/components/webcomponentsjs/HTMLImports.js +1078 -0
  175. data/app/assets/components/webcomponentsjs/HTMLImports.min.js +11 -0
  176. data/app/assets/components/webcomponentsjs/MutationObserver.js +344 -0
  177. data/app/assets/components/webcomponentsjs/MutationObserver.min.js +11 -0
  178. data/app/assets/components/webcomponentsjs/ShadowDOM.js +4414 -0
  179. data/app/assets/components/webcomponentsjs/ShadowDOM.min.js +15 -0
  180. data/app/assets/components/webcomponentsjs/package.json +31 -0
  181. data/app/assets/components/webcomponentsjs/webcomponents-lite.js +2300 -0
  182. data/app/assets/components/webcomponentsjs/webcomponents-lite.min.js +13 -0
  183. data/app/assets/components/webcomponentsjs/webcomponents.js +7112 -0
  184. data/app/assets/components/webcomponentsjs/webcomponents.min.js +15 -0
  185. data/lib/polymer-paper-elements-rails.rb +2 -0
  186. data/lib/polymer-paper-elements-rails/engine.rb +4 -0
  187. data/lib/polymer-paper-elements-rails/version.rb +3 -0
  188. metadata +272 -0
@@ -0,0 +1,41 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ viewBox="0 0 225 126" enable-background="new 0 0 225 126" xml:space="preserve">
6
+ <g id="background" display="none">
7
+ <rect display="inline" fill="#B0BEC5" width="225" height="126"/>
8
+ </g>
9
+ <g id="label">
10
+ </g>
11
+ <g id="art">
12
+ <circle cx="170.6" cy="28.5" r="4"/>
13
+ <circle cx="170.6" cy="58.5" r="4"/>
14
+ <rect x="170" y="29" width="2" height="30"/>
15
+ <path d="M163,102H73V24h90V102z M75,100h86V26H75V100z"/>
16
+ <rect x="74" y="62" width="88" height="2"/>
17
+ <g id="ic_x5F_add_x0D_">
18
+ </g>
19
+ <g>
20
+ <polygon points="74,59.6 74,62.5 74.5,63 77.4,63 "/>
21
+ <polygon points="74,51.9 74,54.7 82.3,63 85.1,63 "/>
22
+ <polygon points="74,44.1 74,46.9 90.1,63 92.9,63 "/>
23
+ <polygon points="74,36.3 74,39.2 97.8,63 100.7,63 "/>
24
+ <polygon points="74,28.6 74,31.4 105.6,63 108.4,63 "/>
25
+ <polygon points="78.2,25 75.4,25 113.4,63 116.2,63 "/>
26
+ <polygon points="86,25 83.1,25 121.1,63 124,63 "/>
27
+ <polygon points="93.7,25 90.9,25 128.9,63 131.7,63 "/>
28
+ <polygon points="101.5,25 98.7,25 136.7,63 139.5,63 "/>
29
+ <polygon points="109.2,25 106.4,25 144.4,63 147.2,63 "/>
30
+ <polygon points="117,25 114.2,25 152.2,63 155,63 "/>
31
+ <polygon points="124.8,25 122,25 160,63 162,63 162,62.2 "/>
32
+ <polygon points="132.5,25 129.7,25 162,57.3 162,54.5 "/>
33
+ <polygon points="140.3,25 137.5,25 162,49.5 162,46.7 "/>
34
+ <polygon points="148.1,25 145.2,25 162,41.8 162,38.9 "/>
35
+ <polygon points="155.8,25 153,25 162,34 162,31.2 "/>
36
+ <polygon points="162,26.2 162,25 160.8,25 "/>
37
+ </g>
38
+ </g>
39
+ <g id="Guides">
40
+ </g>
41
+ </svg>
@@ -0,0 +1,455 @@
1
+ <!--
2
+ @license
3
+ Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4
+ This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5
+ The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6
+ The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7
+ Code distributed by Google as part of the polymer project is also
8
+ subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9
+ -->
10
+
11
+ <link rel="import" href="../polymer/polymer.html">
12
+ <link rel="import" href="../iron-resizable-behavior/iron-resizable-behavior.html">
13
+
14
+ <!--
15
+ `paper-scroll-header-panel` contains a header section and a content section. The
16
+ header is initially on the top part of the view but it scrolls away with the
17
+ rest of the scrollable content. Upon scrolling slightly up at any point, the
18
+ header scrolls back into view. This saves screen space and allows users to
19
+ access important controls by easily moving them back to the view.
20
+
21
+ __Important:__ The `paper-scroll-header-panel` will not display if its parent does not have a height.
22
+
23
+ Using [layout attributes](http://www.polymer-project.org/docs/polymer/layout-attrs.html), you can easily make the `paper-scroll-header-panel` fill the screen
24
+
25
+ <body class="fullbleed layout vertical">
26
+ <paper-scroll-header-panel class="flex">
27
+ <paper-toolbar>
28
+ <div>Hello World!</div>
29
+ </paper-toolbar>
30
+ </paper-scroll-header-panel>
31
+ </body>
32
+
33
+ or, if you would prefer to do it in CSS, just give `html`, `body`, and `paper-scroll-header-panel` a height of 100%:
34
+
35
+ html, body {
36
+ height: 100%;
37
+ margin: 0;
38
+ }
39
+ paper-scroll-header-panel {
40
+ height: 100%;
41
+ }
42
+
43
+ `paper-scroll-header-panel` works well with `paper-toolbar` but can use any element
44
+ that represents a header by adding a `paper-header` class to it.
45
+
46
+ <paper-scroll-header-panel>
47
+ <paper-toolbar>Header</paper-toolbar>
48
+ <div>Content goes here...</div>
49
+ </paper-scroll-header-panel>
50
+
51
+ Styling scroll-header-panel:
52
+
53
+ To change background for toolbar when it is at its full size:
54
+
55
+ paper-scroll-header-panel {
56
+ --paper-scroll-header-panel-full-header: {
57
+ background-color: red;
58
+ };
59
+ }
60
+
61
+ To change the background for toolbar when it is condensed:
62
+
63
+ paper-scroll-header-panel {
64
+ --paper-scroll-header-panel-condensed-header: {
65
+ background-color: #f4b400;
66
+ };
67
+ }
68
+
69
+ @group Paper Element
70
+ @element paper-scrollheader-panel
71
+ @demo demo/index.html
72
+ @hero hero.svg
73
+ -->
74
+
75
+ <dom-module id="paper-scroll-header-panel">
76
+
77
+ <style>
78
+ :host {
79
+ display: block;
80
+ position: relative;
81
+ overflow: hidden;
82
+ }
83
+
84
+ #mainContainer {
85
+ position: absolute;
86
+ top: 0;
87
+ right: 0;
88
+ bottom: 0;
89
+ left: 0;
90
+ box-sizing: border-box;
91
+ -moz-box-sizing: border-box;
92
+ -webkit-overflow-scrolling: touch;
93
+ overflow-x: hidden;
94
+ overflow-_y: auto;
95
+ -webkit-transform: translateZ(0);
96
+ transform: translateZ(0);
97
+ }
98
+
99
+ #headerContainer {
100
+ position: absolute;
101
+ top: 0;
102
+ right: 0;
103
+ left: 0;
104
+ }
105
+
106
+ .bg-container {
107
+ position: absolute;
108
+ top: 0;
109
+ left: 0;
110
+ width: 100%;
111
+ height: 100%;
112
+ overflow: hidden;
113
+ }
114
+
115
+ #headerBg {
116
+ @apply(--paper-scroll-header-panel-full-header);
117
+ }
118
+
119
+ #condensedHeaderBg {
120
+ @apply(--paper-scroll-header-panel-condensed-header);
121
+ }
122
+
123
+ #headerBg, #condensedHeaderBg {
124
+ position: absolute;
125
+ top: 0;
126
+ left: 0;
127
+ width: 100%;
128
+ height: 100%;
129
+ background-repeat: no-repeat;
130
+ background-size: cover;
131
+ background-position: center center;
132
+ }
133
+
134
+ #condensedHeaderBg {
135
+ opacity: 0;
136
+ }
137
+ </style>
138
+ <template>
139
+ <div id="mainContainer">
140
+ <content id="mainContent" select=":not(paper-toolbar):not(.paper-header)"></content>
141
+ </div>
142
+ <div id="headerContainer">
143
+ <div class="bg-container">
144
+ <div id="condensedHeaderBg"></div>
145
+ <div id="headerBg"></div>
146
+ </div>
147
+ <content id="headerContent" select="paper-toolbar, .paper-header"></content>
148
+ </div>
149
+ </template>
150
+ </dom-module>
151
+
152
+ <script>
153
+ (function() {
154
+
155
+ 'use strict';
156
+
157
+ Polymer({
158
+
159
+ /**
160
+ * Fired when the content has been scrolled.
161
+ *
162
+ * @event content-scroll
163
+ */
164
+
165
+ /**
166
+ * Fired when the header is transformed.
167
+ *
168
+ * @event paper-header-transform
169
+ */
170
+
171
+ is: 'paper-scroll-header-panel',
172
+
173
+ behaviors: [
174
+ Polymer.IronResizableBehavior
175
+ ],
176
+
177
+ properties: {
178
+
179
+ /**
180
+ * If true, the header's height will condense to `_condensedHeaderHeight`
181
+ * as the user scrolls down from the top of the content area.
182
+ */
183
+ condenses: {
184
+ type: Boolean,
185
+ value: false,
186
+ observer: '_condensesChanged'
187
+ },
188
+
189
+ /**
190
+ * If true, no cross-fade transition from one background to another.
191
+ */
192
+ noDissolve: {
193
+ type: Boolean,
194
+ value: false
195
+ },
196
+
197
+ /**
198
+ * If true, the header doesn't slide back in when scrolling back up.
199
+ */
200
+ noReveal: {
201
+ type: Boolean,
202
+ value: false
203
+ },
204
+
205
+ /**
206
+ * If true, the header is fixed to the top and never moves away.
207
+ */
208
+ fixed: {
209
+ type: Boolean,
210
+ value: false
211
+ },
212
+
213
+ /**
214
+ * If true, the condensed header is always shown and does not move away.
215
+ */
216
+ keepCondensedHeader: {
217
+ type: Boolean,
218
+ value: false
219
+ },
220
+
221
+ /**
222
+ * The height of the header when it is at its full size.
223
+ *
224
+ * By default, the height will be measured when it is ready. If the height
225
+ * changes later the user needs to either set this value to reflect the
226
+ * new height or invoke `measureHeaderHeight()`.
227
+ */
228
+ headerHeight: {
229
+ type: Number,
230
+ value: 0
231
+ },
232
+
233
+ /**
234
+ * The height of the header when it is condensed.
235
+ *
236
+ * By default, `_condensedHeaderHeight` is 1/3 of `headerHeight` unless
237
+ * this is specified.
238
+ */
239
+ condensedHeaderHeight: {
240
+ type: Number,
241
+ value: 0
242
+ },
243
+
244
+ /**
245
+ * By default, the top part of the header stays when the header is being
246
+ * condensed. Set this to true if you want the top part of the header
247
+ * to be scrolled away.
248
+ */
249
+ scrollAwayTopbar: {
250
+ type: Boolean,
251
+ value: false
252
+ },
253
+
254
+ _headerMargin: {
255
+ type: Number
256
+ },
257
+
258
+ _prevScrollTop: {
259
+ type: Number
260
+ },
261
+
262
+ _y: {
263
+ type: Number
264
+ }
265
+
266
+ },
267
+
268
+ observers: [
269
+ '_setup(_headerMargin, headerHeight, fixed)',
270
+ '_headerHeightChanged(headerHeight, condensedHeaderHeight)',
271
+ '_condensedHeaderHeightChanged(headerHeight, condensedHeaderHeight)'
272
+ ],
273
+
274
+ listeners: {
275
+ 'iron-resize': 'measureHeaderHeight'
276
+ },
277
+
278
+ ready: function() {
279
+ this.async(this.measureHeaderHeight, 5);
280
+ this._scrollHandler = this._scroll.bind(this);
281
+ this.scroller.addEventListener('scroll', this._scrollHandler);
282
+ },
283
+
284
+ detached: function() {
285
+ this.scroller.removeEventListener('scroll', this._scrollHandler);
286
+ },
287
+
288
+ /**
289
+ * Returns the header element.
290
+ *
291
+ * @property header
292
+ * @type Object
293
+ */
294
+ get header() {
295
+ return Polymer.dom(this.$.headerContent).getDistributedNodes()[0];
296
+ },
297
+
298
+ /**
299
+ * Returns the content element.
300
+ *
301
+ * @property content
302
+ * @type Object
303
+ */
304
+ get content() {
305
+ return Polymer.dom(this.$.mainContent).getDistributedNodes()[0];
306
+ },
307
+
308
+ /**
309
+ * Returns the scrollable element.
310
+ *
311
+ * @property scroller
312
+ * @type Object
313
+ */
314
+ get scroller() {
315
+ return this.$.mainContainer;
316
+ },
317
+
318
+ /**
319
+ * Invoke this to tell `paper-scroll-header-panel` to re-measure the header's
320
+ * height.
321
+ *
322
+ * @method measureHeaderHeight
323
+ */
324
+ measureHeaderHeight: function() {
325
+ var header = this.header;
326
+ if (header && header.offsetHeight) {
327
+ this.headerHeight = header.offsetHeight;
328
+ }
329
+ },
330
+
331
+ _headerHeightChanged: function() {
332
+ if (!this.condensedHeaderHeight) {
333
+ // assume condensedHeaderHeight is 1/3 of the headerHeight
334
+ this.condensedHeaderHeight = this.headerHeight * 1 / 3;
335
+ }
336
+ },
337
+
338
+ _condensedHeaderHeightChanged: function() {
339
+ if (this.headerHeight) {
340
+ this._headerMargin = this.headerHeight - this.condensedHeaderHeight;
341
+ }
342
+ },
343
+
344
+ _condensesChanged: function() {
345
+ if (this.condenses) {
346
+ this._scroll();
347
+ } else {
348
+ // reset transform/opacity set on the header
349
+ this._condenseHeader(null);
350
+ }
351
+ },
352
+
353
+ _setup: function() {
354
+ var s = this.scroller.style;
355
+ s.paddingTop = this.fixed ? '' : this.headerHeight + 'px';
356
+
357
+ s.top = this.fixed ? this.headerHeight + 'px' : '';
358
+
359
+ if (this.fixed) {
360
+ this._transformHeader(null);
361
+ } else {
362
+ this._scroll();
363
+ }
364
+ },
365
+
366
+ _transformHeader: function(y) {
367
+ var s = this.$.headerContainer.style;
368
+ this._translateY(s, -y);
369
+
370
+ if (this.condenses) {
371
+ this._condenseHeader(y);
372
+ }
373
+
374
+ this.fire('paper-header-transform', {y: y, height: this.headerHeight,
375
+ condensedHeight: this.condensedHeaderHeight});
376
+ },
377
+
378
+ _condenseHeader: function(y) {
379
+ var reset = (y === null);
380
+
381
+ // adjust top bar in paper-header so the top bar stays at the top
382
+ if (!this.scrollAwayTopbar && this.header.$ && this.header.$.topBar) {
383
+ this._translateY(this.header.$.topBar.style,
384
+ reset ? null : Math.min(y, this._headerMargin));
385
+ }
386
+ // transition header bg
387
+ var hbg = this.$.headerBg.style;
388
+ if (!this.noDissolve) {
389
+ hbg.opacity = reset ? '' : (this._headerMargin - y) / this._headerMargin;
390
+ }
391
+ // adjust header bg so it stays at the center
392
+ this._translateY(hbg, reset ? null : y / 2);
393
+ // transition condensed header bg
394
+ if (!this.noDissolve) {
395
+ var chbg = this.$.condensedHeaderBg.style;
396
+ chbg = this.$.condensedHeaderBg.style;
397
+ chbg.opacity = reset ? '' : y / this._headerMargin;
398
+
399
+ // adjust condensed header bg so it stays at the center
400
+ this._translateY(chbg, reset ? null : y / 2);
401
+ }
402
+ },
403
+
404
+ _translateY: function(s, y) {
405
+ var t = (y === null) ? '' : 'translate3d(0, ' + y + 'px, 0)';
406
+ setTransform(s, t);
407
+ },
408
+
409
+ /** @param {Event=} event */
410
+ _scroll: function(event) {
411
+ if (!this.header) {
412
+ return;
413
+ }
414
+
415
+ var sTop = this.scroller.scrollTop;
416
+
417
+ this._y = this._y || 0;
418
+ this._prevScrollTop = this._prevScrollTop || 0;
419
+
420
+ var y = Math.min(this.keepCondensedHeader ?
421
+ this._headerMargin : this.headerHeight, Math.max(0,
422
+ (this.noReveal ? sTop : this._y + sTop - this._prevScrollTop)));
423
+
424
+ if (this.condenses && this._prevScrollTop >= sTop && sTop > this._headerMargin) {
425
+ y = Math.max(y, this._headerMargin);
426
+ }
427
+
428
+ if (!event || !this.fixed && y !== this._y) {
429
+ this._transformHeader(y);
430
+ }
431
+
432
+ this._prevScrollTop = Math.max(sTop, 0);
433
+ this._y = y;
434
+
435
+ if (event) {
436
+ this.fire('content-scroll', {target: this.scroller}, {cancelable: false});
437
+ }
438
+ }
439
+
440
+ });
441
+
442
+ //determine proper transform mechanizm
443
+ if (document.documentElement.style.transform !== undefined) {
444
+ var setTransform = function(style, string) {
445
+ style.transform = string;
446
+ }
447
+ } else {
448
+ var setTransform = function(style, string) {
449
+ style.webkitTransform = string;
450
+ }
451
+ }
452
+
453
+ })();
454
+
455
+ </script>