polymer-neon-rails 1.0.0.pre.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +39 -0
- data/Rakefile +1 -0
- data/app/assets/components/iron-flex-layout/README.md +4 -0
- data/app/assets/components/iron-flex-layout/bower.json +21 -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/demo/index.html +40 -0
- data/app/assets/components/iron-flex-layout/demo/x-app.html +106 -0
- data/app/assets/components/iron-flex-layout/iron-flex-layout.html +313 -0
- data/app/assets/components/iron-meta/README.md +46 -0
- data/app/assets/components/iron-meta/bower.json +28 -0
- data/app/assets/components/iron-meta/demo/index.html +45 -0
- data/app/assets/components/iron-meta/hero.svg +33 -0
- data/app/assets/components/iron-meta/index.html +27 -0
- data/app/assets/components/iron-meta/iron-meta.html +352 -0
- data/app/assets/components/iron-meta/test/basic.html +48 -0
- data/app/assets/components/iron-meta/test/index.html +30 -0
- data/app/assets/components/iron-meta/test/iron-meta.html +186 -0
- data/app/assets/components/iron-resizable-behavior/README.md +16 -0
- data/app/assets/components/iron-resizable-behavior/bower.json +26 -0
- data/app/assets/components/iron-resizable-behavior/demo/index.html +29 -0
- data/app/assets/components/iron-resizable-behavior/demo/src/x-app.html +114 -0
- data/app/assets/components/iron-resizable-behavior/index.html +25 -0
- data/app/assets/components/iron-resizable-behavior/iron-resizable-behavior.html +139 -0
- data/app/assets/components/iron-resizable-behavior/test/basic.html +263 -0
- data/app/assets/components/iron-resizable-behavior/test/index.html +31 -0
- data/app/assets/components/iron-resizable-behavior/test/test-elements.html +143 -0
- data/app/assets/components/iron-selector/README.md +50 -0
- data/app/assets/components/iron-selector/bower.json +31 -0
- data/app/assets/components/iron-selector/demo/index.html +66 -0
- data/app/assets/components/iron-selector/index.html +28 -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-selector/test/activate-event.html +138 -0
- data/app/assets/components/iron-selector/test/basic.html +150 -0
- data/app/assets/components/iron-selector/test/content-element.html +43 -0
- data/app/assets/components/iron-selector/test/content.html +168 -0
- data/app/assets/components/iron-selector/test/index.html +36 -0
- data/app/assets/components/iron-selector/test/multi.html +135 -0
- data/app/assets/components/iron-selector/test/next-previous.html +134 -0
- data/app/assets/components/iron-selector/test/selected-attribute.html +72 -0
- data/app/assets/components/iron-selector/test/template-repeat.html +110 -0
- data/app/assets/components/neon-animation/README.md +304 -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/bower.json +51 -0
- data/app/assets/components/neon-animation/demo/declarative/index.html +108 -0
- data/app/assets/components/neon-animation/demo/doc/basic.html +47 -0
- data/app/assets/components/neon-animation/demo/doc/my-animatable.html +73 -0
- data/app/assets/components/neon-animation/demo/doc/my-dialog.html +97 -0
- data/app/assets/components/neon-animation/demo/doc/types.html +53 -0
- data/app/assets/components/neon-animation/demo/dropdown/animated-dropdown.html +97 -0
- data/app/assets/components/neon-animation/demo/dropdown/index.html +54 -0
- data/app/assets/components/neon-animation/demo/grid/animated-grid.html +166 -0
- data/app/assets/components/neon-animation/demo/grid/fullsize-page-with-card.html +124 -0
- data/app/assets/components/neon-animation/demo/grid/index.html +70 -0
- data/app/assets/components/neon-animation/demo/index.html +6 -0
- data/app/assets/components/neon-animation/demo/list/full-view.html +122 -0
- data/app/assets/components/neon-animation/demo/list/index.html +29 -0
- data/app/assets/components/neon-animation/demo/list/list-demo.html +112 -0
- data/app/assets/components/neon-animation/demo/list/list-view.html +127 -0
- data/app/assets/components/neon-animation/demo/load/animated-grid.html +147 -0
- data/app/assets/components/neon-animation/demo/load/full-page.html +86 -0
- data/app/assets/components/neon-animation/demo/load/index.html +45 -0
- data/app/assets/components/neon-animation/demo/reprojection/animated-grid.html +166 -0
- data/app/assets/components/neon-animation/demo/reprojection/fullsize-page-with-card.html +124 -0
- data/app/assets/components/neon-animation/demo/reprojection/index.html +66 -0
- data/app/assets/components/neon-animation/demo/reprojection/reprojected-pages.html +42 -0
- data/app/assets/components/neon-animation/demo/shared.css +40 -0
- data/app/assets/components/neon-animation/demo/tiles/circles-page.html +110 -0
- data/app/assets/components/neon-animation/demo/tiles/index.html +77 -0
- data/app/assets/components/neon-animation/demo/tiles/squares-page.html +104 -0
- data/app/assets/components/neon-animation/guides/neon-animation.md +313 -0
- data/app/assets/components/neon-animation/index.html +30 -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/neon-elements/README.md +19 -0
- data/app/assets/components/neon-elements/bower.json +26 -0
- data/app/assets/components/paper-styles/README.md +3 -0
- data/app/assets/components/paper-styles/bower.json +27 -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/demo-pages.html +72 -0
- data/app/assets/components/paper-styles/demo.css +25 -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/polymer/LICENSE.txt +27 -0
- data/app/assets/components/polymer/bower.json +26 -0
- data/app/assets/components/polymer/build.log +27 -0
- data/app/assets/components/polymer/polymer-micro.html +523 -0
- data/app/assets/components/polymer/polymer-mini.html +1368 -0
- data/app/assets/components/polymer/polymer.html +3768 -0
- data/app/assets/components/web-animations-js/COPYING +202 -0
- data/app/assets/components/web-animations-js/History.md +108 -0
- data/app/assets/components/web-animations-js/README.md +161 -0
- data/app/assets/components/web-animations-js/bower.json +31 -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-lite.min.js.map +1 -0
- data/app/assets/components/web-animations-js/web-animations-next.min.js +17 -0
- data/app/assets/components/web-animations-js/web-animations-next.min.js.map +1 -0
- data/app/assets/components/web-animations-js/web-animations.html +50 -0
- data/app/assets/components/web-animations-js/web-animations.min.js +17 -0
- data/app/assets/components/web-animations-js/web-animations.min.js.gz +0 -0
- data/app/assets/components/web-animations-js/web-animations.min.js.map +1 -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/README.md +125 -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/bower.json +14 -0
- data/app/assets/components/webcomponentsjs/build.log +33 -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-neon-rails.rb +2 -0
- data/lib/polymer-neon-rails/engine.rb +4 -0
- data/lib/polymer-neon-rails/version.rb +3 -0
- metadata +264 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<!--
|
3
|
+
@license
|
4
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
5
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
6
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
7
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
8
|
+
Code distributed by Google as part of the polymer project is also
|
9
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
10
|
+
-->
|
11
|
+
<html>
|
12
|
+
<head>
|
13
|
+
|
14
|
+
<meta charset="utf-8">
|
15
|
+
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
16
|
+
|
17
|
+
<title>neon-animation</title>
|
18
|
+
|
19
|
+
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
|
20
|
+
|
21
|
+
<link rel="import" href="../polymer/polymer.html">
|
22
|
+
<link rel="import" href="../iron-component-page/iron-component-page.html">
|
23
|
+
|
24
|
+
</head>
|
25
|
+
<body>
|
26
|
+
|
27
|
+
<iron-component-page></iron-component-page>
|
28
|
+
|
29
|
+
</body>
|
30
|
+
</html>
|
@@ -0,0 +1,156 @@
|
|
1
|
+
<!--
|
2
|
+
Copyright (c) 2015 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
|
+
<link rel="import" href="../polymer/polymer.html">
|
11
|
+
<link rel="import" href="animations/opaque-animation.html">
|
12
|
+
|
13
|
+
<script>
|
14
|
+
|
15
|
+
/**
|
16
|
+
* `Polymer.NeonAnimatableBehavior` is implemented by elements containing animations for use with
|
17
|
+
* elements implementing `Polymer.NeonAnimationRunnerBehavior`.
|
18
|
+
* @polymerBehavior
|
19
|
+
*/
|
20
|
+
Polymer.NeonAnimatableBehavior = {
|
21
|
+
|
22
|
+
properties: {
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Animation configuration. See README for more info.
|
26
|
+
*/
|
27
|
+
animationConfig: {
|
28
|
+
type: Object
|
29
|
+
},
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Convenience property for setting an 'entry' animation. Do not set `animationConfig.entry`
|
33
|
+
* manually if using this. The animated node is set to `this` if using this property.
|
34
|
+
*/
|
35
|
+
entryAnimation: {
|
36
|
+
observer: '_entryAnimationChanged',
|
37
|
+
type: String
|
38
|
+
},
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Convenience property for setting an 'exit' animation. Do not set `animationConfig.exit`
|
42
|
+
* manually if using this. The animated node is set to `this` if using this property.
|
43
|
+
*/
|
44
|
+
exitAnimation: {
|
45
|
+
observer: '_exitAnimationChanged',
|
46
|
+
type: String
|
47
|
+
}
|
48
|
+
|
49
|
+
},
|
50
|
+
|
51
|
+
_entryAnimationChanged: function() {
|
52
|
+
this.animationConfig = this.animationConfig || {};
|
53
|
+
if (this.entryAnimation !== 'fade-in-animation') {
|
54
|
+
// insert polyfill hack
|
55
|
+
this.animationConfig['entry'] = [{
|
56
|
+
name: 'opaque-animation',
|
57
|
+
node: this
|
58
|
+
}, {
|
59
|
+
name: this.entryAnimation,
|
60
|
+
node: this
|
61
|
+
}];
|
62
|
+
} else {
|
63
|
+
this.animationConfig['entry'] = [{
|
64
|
+
name: this.entryAnimation,
|
65
|
+
node: this
|
66
|
+
}];
|
67
|
+
}
|
68
|
+
},
|
69
|
+
|
70
|
+
_exitAnimationChanged: function() {
|
71
|
+
this.animationConfig = this.animationConfig || {};
|
72
|
+
this.animationConfig['exit'] = [{
|
73
|
+
name: this.exitAnimation,
|
74
|
+
node: this
|
75
|
+
}];
|
76
|
+
},
|
77
|
+
|
78
|
+
_copyProperties: function(config1, config2) {
|
79
|
+
// shallowly copy properties from config2 to config1
|
80
|
+
for (var property in config2) {
|
81
|
+
config1[property] = config2[property];
|
82
|
+
}
|
83
|
+
},
|
84
|
+
|
85
|
+
_cloneConfig: function(config) {
|
86
|
+
var clone = {
|
87
|
+
isClone: true
|
88
|
+
};
|
89
|
+
this._copyProperties(clone, config);
|
90
|
+
return clone;
|
91
|
+
},
|
92
|
+
|
93
|
+
_getAnimationConfigRecursive: function(type, map, allConfigs) {
|
94
|
+
if (!this.animationConfig) {
|
95
|
+
return;
|
96
|
+
}
|
97
|
+
|
98
|
+
// type is optional
|
99
|
+
var thisConfig;
|
100
|
+
if (type) {
|
101
|
+
thisConfig = this.animationConfig[type];
|
102
|
+
} else {
|
103
|
+
thisConfig = this.animationConfig;
|
104
|
+
}
|
105
|
+
|
106
|
+
if (!Array.isArray(thisConfig)) {
|
107
|
+
thisConfig = [thisConfig];
|
108
|
+
}
|
109
|
+
|
110
|
+
// iterate animations and recurse to process configurations from child nodes
|
111
|
+
if (thisConfig) {
|
112
|
+
for (var config, index = 0; config = thisConfig[index]; index++) {
|
113
|
+
if (config.animatable) {
|
114
|
+
config.animatable._getAnimationConfigRecursive(config.type || type, map, allConfigs);
|
115
|
+
} else {
|
116
|
+
if (config.id) {
|
117
|
+
var cachedConfig = map[config.id];
|
118
|
+
if (cachedConfig) {
|
119
|
+
// merge configurations with the same id, making a clone lazily
|
120
|
+
if (!cachedConfig.isClone) {
|
121
|
+
map[config.id] = this._cloneConfig(cachedConfig)
|
122
|
+
cachedConfig = map[config.id];
|
123
|
+
}
|
124
|
+
this._copyProperties(cachedConfig, config);
|
125
|
+
} else {
|
126
|
+
// put any configs with an id into a map
|
127
|
+
map[config.id] = config;
|
128
|
+
}
|
129
|
+
} else {
|
130
|
+
allConfigs.push(config);
|
131
|
+
}
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
135
|
+
},
|
136
|
+
|
137
|
+
/**
|
138
|
+
* An element implementing `Polymer.NeonAnimationRunnerBehavior` calls this method to configure
|
139
|
+
* an animation with an optional type. Elements implementing `Polymer.NeonAnimatableBehavior`
|
140
|
+
* should define the property `animationConfig`, which is either a configuration object
|
141
|
+
* or a map of animation type to array of configuration objects.
|
142
|
+
*/
|
143
|
+
getAnimationConfig: function(type) {
|
144
|
+
var map = [];
|
145
|
+
var allConfigs = [];
|
146
|
+
this._getAnimationConfigRecursive(type, map, allConfigs);
|
147
|
+
// append the configurations saved in the map to the array
|
148
|
+
for (var key in map) {
|
149
|
+
allConfigs.push(map[key]);
|
150
|
+
}
|
151
|
+
return allConfigs;
|
152
|
+
}
|
153
|
+
|
154
|
+
};
|
155
|
+
|
156
|
+
</script>
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<!--
|
2
|
+
Copyright (c) 2015 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
|
+
<link rel="import" href="../polymer/polymer.html">
|
11
|
+
<link rel="import" href="neon-animatable-behavior.html">
|
12
|
+
|
13
|
+
<!--
|
14
|
+
`<neon-animatable>` is a simple container element implementing `Polymer.NeonAnimatableBehavior`. This is a convenience element for use with `<neon-animated-pages>`.
|
15
|
+
|
16
|
+
```
|
17
|
+
<neon-animated-pages selected="0"
|
18
|
+
entry-animation="slide-from-right-animation"
|
19
|
+
exit-animation="slide-left-animation">
|
20
|
+
<neon-animatable>1</neon-animatable>
|
21
|
+
<neon-animatable>2</neon-animatable>
|
22
|
+
</neon-animated-pages>
|
23
|
+
```
|
24
|
+
-->
|
25
|
+
|
26
|
+
<dom-module id="neon-animatable">
|
27
|
+
|
28
|
+
<style>
|
29
|
+
|
30
|
+
:host {
|
31
|
+
display: block;
|
32
|
+
}
|
33
|
+
|
34
|
+
</style>
|
35
|
+
|
36
|
+
<template>
|
37
|
+
<content></content>
|
38
|
+
</template>
|
39
|
+
|
40
|
+
</dom-module>
|
41
|
+
|
42
|
+
<script>
|
43
|
+
|
44
|
+
Polymer({
|
45
|
+
|
46
|
+
is: 'neon-animatable',
|
47
|
+
|
48
|
+
behaviors: [
|
49
|
+
Polymer.NeonAnimatableBehavior
|
50
|
+
]
|
51
|
+
|
52
|
+
});
|
53
|
+
|
54
|
+
</script>
|
@@ -0,0 +1,208 @@
|
|
1
|
+
<!--
|
2
|
+
Copyright (c) 2015 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
|
+
<link rel="import" href="../polymer/polymer.html">
|
10
|
+
<link rel="import" href="../iron-resizable-behavior/iron-resizable-behavior.html">
|
11
|
+
<link rel="import" href="../iron-selector/iron-selectable.html">
|
12
|
+
<link rel="import" href="../paper-styles/paper-styles.html">
|
13
|
+
<link rel="import" href="neon-animation-runner-behavior.html">
|
14
|
+
<link rel="import" href="animations/opaque-animation.html">
|
15
|
+
|
16
|
+
<!--
|
17
|
+
`neon-animated-pages` manages a set of pages and runs an animation when switching between them. Its
|
18
|
+
children pages should implement `Polymer.NeonAnimatableBehavior` and define `entry` and `exit`
|
19
|
+
animations to be run when switching to or switching out of the page.
|
20
|
+
|
21
|
+
@group Neon Elements
|
22
|
+
@element neon-animated-pages
|
23
|
+
@demo demo/index.html
|
24
|
+
-->
|
25
|
+
|
26
|
+
<dom-module id="neon-animated-pages">
|
27
|
+
|
28
|
+
<style>
|
29
|
+
|
30
|
+
:host {
|
31
|
+
display: block;
|
32
|
+
position: relative;
|
33
|
+
}
|
34
|
+
|
35
|
+
:host > ::content > * {
|
36
|
+
@apply(--layout-fit);
|
37
|
+
height: 100%;
|
38
|
+
}
|
39
|
+
|
40
|
+
:host > ::content > :not(.iron-selected):not(.neon-animating) {
|
41
|
+
display: none !important;
|
42
|
+
}
|
43
|
+
|
44
|
+
:host > ::content > .neon-animating {
|
45
|
+
pointer-events: none;
|
46
|
+
}
|
47
|
+
|
48
|
+
</style>
|
49
|
+
|
50
|
+
<template>
|
51
|
+
<content id="content"></content>
|
52
|
+
</template>
|
53
|
+
|
54
|
+
</dom-module>
|
55
|
+
|
56
|
+
<script>
|
57
|
+
(function() {
|
58
|
+
|
59
|
+
Polymer({
|
60
|
+
|
61
|
+
is: 'neon-animated-pages',
|
62
|
+
|
63
|
+
behaviors: [
|
64
|
+
Polymer.IronResizableBehavior,
|
65
|
+
Polymer.IronSelectableBehavior,
|
66
|
+
Polymer.NeonAnimationRunnerBehavior
|
67
|
+
],
|
68
|
+
|
69
|
+
properties: {
|
70
|
+
|
71
|
+
activateEvent: {
|
72
|
+
type: String,
|
73
|
+
value: ''
|
74
|
+
},
|
75
|
+
|
76
|
+
// if true, the initial page selection will also be animated according to its animation config.
|
77
|
+
animateInitialSelection: {
|
78
|
+
type: Boolean,
|
79
|
+
value: false
|
80
|
+
}
|
81
|
+
|
82
|
+
},
|
83
|
+
|
84
|
+
observers: [
|
85
|
+
'_selectedChanged(selected)'
|
86
|
+
],
|
87
|
+
|
88
|
+
listeners: {
|
89
|
+
'neon-animation-finish': '_onNeonAnimationFinish'
|
90
|
+
},
|
91
|
+
|
92
|
+
_selectedChanged: function(selected) {
|
93
|
+
|
94
|
+
var selectedPage = this.selectedItem;
|
95
|
+
var oldPage = this._prevSelected || false;
|
96
|
+
this._prevSelected = selectedPage;
|
97
|
+
|
98
|
+
// on initial load and if animateInitialSelection is negated, simply display selectedPage.
|
99
|
+
if (!oldPage && !this.animateInitialSelection) {
|
100
|
+
this._completeSelectedChanged();
|
101
|
+
return;
|
102
|
+
}
|
103
|
+
|
104
|
+
// insert safari fix.
|
105
|
+
this.animationConfig = [{
|
106
|
+
name: 'opaque-animation',
|
107
|
+
node: selectedPage
|
108
|
+
}];
|
109
|
+
|
110
|
+
// configure selectedPage animations.
|
111
|
+
if (this.entryAnimation) {
|
112
|
+
this.animationConfig.push({
|
113
|
+
name: this.entryAnimation,
|
114
|
+
node: selectedPage
|
115
|
+
});
|
116
|
+
} else {
|
117
|
+
if (selectedPage.getAnimationConfig) {
|
118
|
+
this.animationConfig.push({
|
119
|
+
animatable: selectedPage,
|
120
|
+
type: 'entry'
|
121
|
+
});
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
// configure oldPage animations iff exists.
|
126
|
+
if (oldPage) {
|
127
|
+
|
128
|
+
// cancel the currently running animation if one is ongoing.
|
129
|
+
if (oldPage.classList.contains('neon-animating')) {
|
130
|
+
this._squelchNextFinishEvent = true;
|
131
|
+
this.cancelAnimation();
|
132
|
+
this._completeSelectedChanged();
|
133
|
+
}
|
134
|
+
|
135
|
+
// configure the animation.
|
136
|
+
if (this.exitAnimation) {
|
137
|
+
this.animationConfig.push({
|
138
|
+
name: this.exitAnimation,
|
139
|
+
node: oldPage
|
140
|
+
});
|
141
|
+
} else {
|
142
|
+
if (oldPage.getAnimationConfig) {
|
143
|
+
this.animationConfig.push({
|
144
|
+
animatable: oldPage,
|
145
|
+
type: 'exit'
|
146
|
+
});
|
147
|
+
}
|
148
|
+
}
|
149
|
+
|
150
|
+
// display the oldPage during the transition.
|
151
|
+
oldPage.classList.add('neon-animating');
|
152
|
+
}
|
153
|
+
|
154
|
+
// display the selectedPage during the transition.
|
155
|
+
selectedPage.classList.add('neon-animating');
|
156
|
+
|
157
|
+
// actually run the animations.
|
158
|
+
if (this.animationConfig.length > 1) {
|
159
|
+
|
160
|
+
// on first load, ensure we run animations only after element is attached.
|
161
|
+
if (!this.isAttached) {
|
162
|
+
this.async(function () {
|
163
|
+
this.playAnimation(null, {
|
164
|
+
fromPage: null,
|
165
|
+
toPage: selectedPage
|
166
|
+
});
|
167
|
+
});
|
168
|
+
|
169
|
+
} else {
|
170
|
+
this.playAnimation(null, {
|
171
|
+
fromPage: oldPage,
|
172
|
+
toPage: selectedPage
|
173
|
+
});
|
174
|
+
}
|
175
|
+
|
176
|
+
} else {
|
177
|
+
this._completeSelectedChanged(oldPage, selectedPage);
|
178
|
+
}
|
179
|
+
},
|
180
|
+
|
181
|
+
_completeSelectedChanged: function(oldPage, selectedPage) {
|
182
|
+
if (selectedPage) {
|
183
|
+
selectedPage.classList.remove('neon-animating');
|
184
|
+
}
|
185
|
+
if (oldPage) {
|
186
|
+
oldPage.classList.remove('neon-animating');
|
187
|
+
}
|
188
|
+
if (!selectedPage || !oldPage) {
|
189
|
+
var nodes = Polymer.dom(this.$.content).getDistributedNodes();
|
190
|
+
for (var node, index = 0; node = nodes[index]; index++) {
|
191
|
+
node.classList && node.classList.remove('neon-animating');
|
192
|
+
}
|
193
|
+
}
|
194
|
+
this.async(this.notifyResize);
|
195
|
+
},
|
196
|
+
|
197
|
+
_onNeonAnimationFinish: function(event) {
|
198
|
+
if (this._squelchNextFinishEvent) {
|
199
|
+
this._squelchNextFinishEvent = false;
|
200
|
+
return;
|
201
|
+
}
|
202
|
+
this._completeSelectedChanged(event.detail.fromPage, event.detail.toPage);
|
203
|
+
}
|
204
|
+
|
205
|
+
})
|
206
|
+
|
207
|
+
})();
|
208
|
+
</script>
|