polymer-paper-elements-rails 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +51 -0
- data/Rakefile +1 -0
- data/app/assets/components/iron-a11y-announcer/iron-a11y-announcer.html +125 -0
- data/app/assets/components/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html +418 -0
- data/app/assets/components/iron-autogrow-textarea/hero.svg +33 -0
- data/app/assets/components/iron-autogrow-textarea/iron-autogrow-textarea.html +263 -0
- data/app/assets/components/iron-behaviors/iron-button-state.html +195 -0
- data/app/assets/components/iron-behaviors/iron-control-state.html +102 -0
- data/app/assets/components/iron-fit-behavior/iron-fit-behavior.html +230 -0
- data/app/assets/components/iron-flex-layout/classes/iron-flex-layout.html +307 -0
- data/app/assets/components/iron-flex-layout/classes/iron-shadow-flex-layout.html +302 -0
- data/app/assets/components/iron-flex-layout/iron-flex-layout.html +313 -0
- data/app/assets/components/iron-form-element-behavior/iron-form-element-behavior.html +50 -0
- data/app/assets/components/iron-icon/hero.svg +19 -0
- data/app/assets/components/iron-icon/iron-icon.html +187 -0
- data/app/assets/components/iron-icons/av-icons.html +73 -0
- data/app/assets/components/iron-icons/communication-icons.html +59 -0
- data/app/assets/components/iron-icons/device-icons.html +94 -0
- data/app/assets/components/iron-icons/editor-icons.html +70 -0
- data/app/assets/components/iron-icons/hardware-icons.html +61 -0
- data/app/assets/components/iron-icons/hero.svg +35 -0
- data/app/assets/components/iron-icons/image-icons.html +164 -0
- data/app/assets/components/iron-icons/iron-icons.html +303 -0
- data/app/assets/components/iron-icons/maps-icons.html +71 -0
- data/app/assets/components/iron-icons/notification-icons.html +62 -0
- data/app/assets/components/iron-icons/social-icons.html +40 -0
- data/app/assets/components/iron-iconset-svg/iron-iconset-svg.html +191 -0
- data/app/assets/components/iron-input/hero.svg +19 -0
- data/app/assets/components/iron-input/iron-input.html +235 -0
- data/app/assets/components/iron-media-query/hero.svg +29 -0
- data/app/assets/components/iron-media-query/iron-media-query.html +84 -0
- data/app/assets/components/iron-menu-behavior/iron-menu-behavior.html +214 -0
- data/app/assets/components/iron-menu-behavior/iron-menubar-behavior.html +65 -0
- data/app/assets/components/iron-meta/hero.svg +33 -0
- data/app/assets/components/iron-meta/iron-meta.html +352 -0
- data/app/assets/components/iron-overlay-behavior/iron-overlay-backdrop.html +132 -0
- data/app/assets/components/iron-overlay-behavior/iron-overlay-behavior.html +432 -0
- data/app/assets/components/iron-overlay-behavior/iron-overlay-manager.html +107 -0
- data/app/assets/components/iron-range-behavior/iron-range-behavior.html +101 -0
- data/app/assets/components/iron-resizable-behavior/iron-resizable-behavior.html +139 -0
- data/app/assets/components/iron-selector/iron-multi-selectable.html +120 -0
- data/app/assets/components/iron-selector/iron-selectable.html +307 -0
- data/app/assets/components/iron-selector/iron-selection.html +115 -0
- data/app/assets/components/iron-selector/iron-selector.html +71 -0
- data/app/assets/components/iron-validatable-behavior/iron-validatable-behavior.html +100 -0
- data/app/assets/components/neon-animation/animations/cascaded-animation.html +84 -0
- data/app/assets/components/neon-animation/animations/fade-in-animation.html +49 -0
- data/app/assets/components/neon-animation/animations/fade-out-animation.html +49 -0
- data/app/assets/components/neon-animation/animations/hero-animation.html +83 -0
- data/app/assets/components/neon-animation/animations/opaque-animation.html +46 -0
- data/app/assets/components/neon-animation/animations/ripple-animation.html +92 -0
- data/app/assets/components/neon-animation/animations/scale-down-animation.html +65 -0
- data/app/assets/components/neon-animation/animations/scale-up-animation.html +58 -0
- data/app/assets/components/neon-animation/animations/slide-down-animation.html +59 -0
- data/app/assets/components/neon-animation/animations/slide-from-left-animation.html +60 -0
- data/app/assets/components/neon-animation/animations/slide-from-right-animation.html +60 -0
- data/app/assets/components/neon-animation/animations/slide-left-animation.html +59 -0
- data/app/assets/components/neon-animation/animations/slide-right-animation.html +59 -0
- data/app/assets/components/neon-animation/animations/slide-up-animation.html +59 -0
- data/app/assets/components/neon-animation/animations/transform-animation.html +61 -0
- data/app/assets/components/neon-animation/guides/neon-animation.md +313 -0
- data/app/assets/components/neon-animation/neon-animatable-behavior.html +156 -0
- data/app/assets/components/neon-animation/neon-animatable.html +54 -0
- data/app/assets/components/neon-animation/neon-animated-pages.html +208 -0
- data/app/assets/components/neon-animation/neon-animation-behavior.html +88 -0
- data/app/assets/components/neon-animation/neon-animation-runner-behavior.html +110 -0
- data/app/assets/components/neon-animation/neon-animation.html +17 -0
- data/app/assets/components/neon-animation/neon-animations.html +25 -0
- data/app/assets/components/neon-animation/neon-shared-element-animatable-behavior.html +37 -0
- data/app/assets/components/neon-animation/neon-shared-element-animation-behavior.html +66 -0
- data/app/assets/components/neon-animation/web-animations.html +11 -0
- data/app/assets/components/paper-behaviors/paper-button-behavior.html +55 -0
- data/app/assets/components/paper-behaviors/paper-inky-focus-behavior.html +44 -0
- data/app/assets/components/paper-button/paper-button.html +177 -0
- data/app/assets/components/paper-checkbox/metadata.html +17 -0
- data/app/assets/components/paper-checkbox/paper-checkbox.css +149 -0
- data/app/assets/components/paper-checkbox/paper-checkbox.html +163 -0
- data/app/assets/components/paper-dialog-behavior/hero.svg +51 -0
- data/app/assets/components/paper-dialog-behavior/paper-dialog-behavior.html +236 -0
- data/app/assets/components/paper-dialog-behavior/paper-dialog-common.css +58 -0
- data/app/assets/components/paper-dialog-scrollable/hero.svg +69 -0
- data/app/assets/components/paper-dialog-scrollable/paper-dialog-scrollable.html +150 -0
- data/app/assets/components/paper-dialog/hero.svg +58 -0
- data/app/assets/components/paper-dialog/paper-dialog.html +122 -0
- data/app/assets/components/paper-drawer-panel/hero.svg +21 -0
- data/app/assets/components/paper-drawer-panel/paper-drawer-panel.css +142 -0
- data/app/assets/components/paper-drawer-panel/paper-drawer-panel.html +585 -0
- data/app/assets/components/paper-fab/paper-fab.html +159 -0
- data/app/assets/components/paper-header-panel/hero.svg +38 -0
- data/app/assets/components/paper-header-panel/paper-header-panel.html +496 -0
- data/app/assets/components/paper-icon-button/paper-icon-button.html +141 -0
- data/app/assets/components/paper-input/all-imports.html +12 -0
- data/app/assets/components/paper-input/hero.svg +19 -0
- data/app/assets/components/paper-input/paper-input-addon-behavior.html +43 -0
- data/app/assets/components/paper-input/paper-input-behavior.html +293 -0
- data/app/assets/components/paper-input/paper-input-char-counter.html +95 -0
- data/app/assets/components/paper-input/paper-input-container.html +495 -0
- data/app/assets/components/paper-input/paper-input-error.html +99 -0
- data/app/assets/components/paper-input/paper-input.html +126 -0
- data/app/assets/components/paper-input/paper-textarea.html +100 -0
- data/app/assets/components/paper-item/all-imports.html +13 -0
- data/app/assets/components/paper-item/paper-icon-item.html +86 -0
- data/app/assets/components/paper-item/paper-item-body.html +93 -0
- data/app/assets/components/paper-item/paper-item-shared.css +19 -0
- data/app/assets/components/paper-item/paper-item.html +95 -0
- data/app/assets/components/paper-material/paper-material.html +98 -0
- data/app/assets/components/paper-menu/hero.svg +35 -0
- data/app/assets/components/paper-menu/paper-menu.html +133 -0
- data/app/assets/components/paper-progress/hero.svg +21 -0
- data/app/assets/components/paper-progress/paper-progress.html +199 -0
- data/app/assets/components/paper-radio-button/hero.svg +22 -0
- data/app/assets/components/paper-radio-button/paper-radio-button.css +109 -0
- data/app/assets/components/paper-radio-button/paper-radio-button.html +148 -0
- data/app/assets/components/paper-radio-group/hero.svg +25 -0
- data/app/assets/components/paper-radio-group/paper-radio-group.html +186 -0
- data/app/assets/components/paper-ripple/hero.svg +30 -0
- data/app/assets/components/paper-ripple/paper-ripple.html +714 -0
- data/app/assets/components/paper-scroll-header-panel/hero.svg +41 -0
- data/app/assets/components/paper-scroll-header-panel/paper-scroll-header-panel.html +455 -0
- data/app/assets/components/paper-slider/hero.svg +20 -0
- data/app/assets/components/paper-slider/paper-slider.css +252 -0
- data/app/assets/components/paper-slider/paper-slider.html +449 -0
- data/app/assets/components/paper-spinner/hero.svg +27 -0
- data/app/assets/components/paper-spinner/paper-spinner.css +325 -0
- data/app/assets/components/paper-spinner/paper-spinner.html +222 -0
- data/app/assets/components/paper-styles/classes/global.html +96 -0
- data/app/assets/components/paper-styles/classes/shadow-layout.html +302 -0
- data/app/assets/components/paper-styles/classes/shadow.html +39 -0
- data/app/assets/components/paper-styles/classes/typography.html +171 -0
- data/app/assets/components/paper-styles/color.html +333 -0
- data/app/assets/components/paper-styles/default-theme.html +39 -0
- data/app/assets/components/paper-styles/paper-styles-classes.html +14 -0
- data/app/assets/components/paper-styles/paper-styles.html +17 -0
- data/app/assets/components/paper-styles/shadow.html +61 -0
- data/app/assets/components/paper-styles/typography.html +240 -0
- data/app/assets/components/paper-tabs/hero.svg +23 -0
- data/app/assets/components/paper-tabs/paper-tab.html +158 -0
- data/app/assets/components/paper-tabs/paper-tabs-icons.html +18 -0
- data/app/assets/components/paper-tabs/paper-tabs.html +483 -0
- data/app/assets/components/paper-toast/hero.svg +20 -0
- data/app/assets/components/paper-toast/paper-toast.html +164 -0
- data/app/assets/components/paper-toggle-button/hero.svg +22 -0
- data/app/assets/components/paper-toggle-button/paper-toggle-button.css +108 -0
- data/app/assets/components/paper-toggle-button/paper-toggle-button.html +183 -0
- data/app/assets/components/paper-toolbar/paper-toolbar.html +375 -0
- data/app/assets/components/polymer-gestures/Gruntfile.js +60 -0
- data/app/assets/components/polymer-gestures/banner.txt +9 -0
- data/app/assets/components/polymer-gestures/build.json +17 -0
- data/app/assets/components/polymer-gestures/conf/karma.conf.js +39 -0
- data/app/assets/components/polymer-gestures/package.json +20 -0
- data/app/assets/components/polymer-gestures/polymer-gestures.html +21 -0
- data/app/assets/components/polymer-gestures/polymer-gestures.js +46 -0
- data/app/assets/components/polymer-gestures/src/dispatcher.js +474 -0
- data/app/assets/components/polymer-gestures/src/eventFactory.js +127 -0
- data/app/assets/components/polymer-gestures/src/hold.js +129 -0
- data/app/assets/components/polymer-gestures/src/mouse.js +135 -0
- data/app/assets/components/polymer-gestures/src/ms.js +80 -0
- data/app/assets/components/polymer-gestures/src/pinch.js +186 -0
- data/app/assets/components/polymer-gestures/src/platform-events.js +39 -0
- data/app/assets/components/polymer-gestures/src/pointer.js +68 -0
- data/app/assets/components/polymer-gestures/src/pointermap.js +67 -0
- data/app/assets/components/polymer-gestures/src/scope.js +10 -0
- data/app/assets/components/polymer-gestures/src/tap.js +103 -0
- data/app/assets/components/polymer-gestures/src/targetfind.js +244 -0
- data/app/assets/components/polymer-gestures/src/touch-action.js +60 -0
- data/app/assets/components/polymer-gestures/src/touch.js +341 -0
- data/app/assets/components/polymer-gestures/src/track.js +230 -0
- data/app/assets/components/web-animations-js/web-animations-next-lite.min.js +17 -0
- data/app/assets/components/web-animations-js/web-animations-next.min.js +17 -0
- data/app/assets/components/web-animations-js/web-animations.min.js +17 -0
- data/app/assets/components/webcomponentsjs/CustomElements.js +956 -0
- data/app/assets/components/webcomponentsjs/CustomElements.min.js +11 -0
- data/app/assets/components/webcomponentsjs/HTMLImports.js +1078 -0
- data/app/assets/components/webcomponentsjs/HTMLImports.min.js +11 -0
- data/app/assets/components/webcomponentsjs/MutationObserver.js +344 -0
- data/app/assets/components/webcomponentsjs/MutationObserver.min.js +11 -0
- data/app/assets/components/webcomponentsjs/ShadowDOM.js +4414 -0
- data/app/assets/components/webcomponentsjs/ShadowDOM.min.js +15 -0
- data/app/assets/components/webcomponentsjs/package.json +31 -0
- data/app/assets/components/webcomponentsjs/webcomponents-lite.js +2300 -0
- data/app/assets/components/webcomponentsjs/webcomponents-lite.min.js +13 -0
- data/app/assets/components/webcomponentsjs/webcomponents.js +7112 -0
- data/app/assets/components/webcomponentsjs/webcomponents.min.js +15 -0
- data/lib/polymer-paper-elements-rails.rb +2 -0
- data/lib/polymer-paper-elements-rails/engine.rb +4 -0
- data/lib/polymer-paper-elements-rails/version.rb +3 -0
- 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>
|