polymer-paper-elements-rails 0.0.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 +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,100 @@
|
|
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-meta/iron-meta.html">
|
13
|
+
|
14
|
+
<script>
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Use `Polymer.IronValidatableBehavior` to implement an element that validates user input.
|
18
|
+
*
|
19
|
+
* ### Accessiblity
|
20
|
+
*
|
21
|
+
* Changing the `invalid` property, either manually or by calling `validate()` will update the
|
22
|
+
* `aria-invalid` attribute.
|
23
|
+
*
|
24
|
+
* @demo demo/index.html
|
25
|
+
* @polymerBehavior
|
26
|
+
*/
|
27
|
+
Polymer.IronValidatableBehavior = {
|
28
|
+
|
29
|
+
properties: {
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Namespace for this validator.
|
33
|
+
*/
|
34
|
+
validatorType: {
|
35
|
+
type: String,
|
36
|
+
value: 'validator'
|
37
|
+
},
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Name of the validator to use.
|
41
|
+
*/
|
42
|
+
validator: {
|
43
|
+
type: String
|
44
|
+
},
|
45
|
+
|
46
|
+
/**
|
47
|
+
* True if the last call to `validate` is invalid.
|
48
|
+
*/
|
49
|
+
invalid: {
|
50
|
+
reflectToAttribute: true,
|
51
|
+
type: Boolean,
|
52
|
+
value: false
|
53
|
+
},
|
54
|
+
|
55
|
+
_validatorMeta: {
|
56
|
+
type: Object
|
57
|
+
}
|
58
|
+
|
59
|
+
},
|
60
|
+
|
61
|
+
observers: [
|
62
|
+
'_invalidChanged(invalid)'
|
63
|
+
],
|
64
|
+
|
65
|
+
get _validator() {
|
66
|
+
return this._validatorMeta && this._validatorMeta.byKey(this.validator);
|
67
|
+
},
|
68
|
+
|
69
|
+
ready: function() {
|
70
|
+
this._validatorMeta = new Polymer.IronMeta({type: this.validatorType});
|
71
|
+
},
|
72
|
+
|
73
|
+
_invalidChanged: function() {
|
74
|
+
if (this.invalid) {
|
75
|
+
this.setAttribute('aria-invalid', 'true');
|
76
|
+
} else {
|
77
|
+
this.removeAttribute('aria-invalid');
|
78
|
+
}
|
79
|
+
},
|
80
|
+
|
81
|
+
/**
|
82
|
+
* @return {Boolean} True if the validator `validator` exists.
|
83
|
+
*/
|
84
|
+
hasValidator: function() {
|
85
|
+
return this._validator != null;
|
86
|
+
},
|
87
|
+
|
88
|
+
/**
|
89
|
+
* @param {Object} values Passed to the validator's `validate()` function.
|
90
|
+
* @return {Boolean} True if `values` is valid.
|
91
|
+
*/
|
92
|
+
validate: function(values) {
|
93
|
+
var valid = this._validator && this._validator.validate(values);
|
94
|
+
this.invalid = !valid;
|
95
|
+
return valid;
|
96
|
+
}
|
97
|
+
|
98
|
+
};
|
99
|
+
|
100
|
+
</script>
|
@@ -0,0 +1,84 @@
|
|
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="../neon-animation-behavior.html">
|
13
|
+
<link rel="import" href="../web-animations.html">
|
14
|
+
|
15
|
+
<!--
|
16
|
+
`<cascaded-animation>` applies an animation on an array of elements with a delay between each.
|
17
|
+
the delay defaults to 50ms.
|
18
|
+
|
19
|
+
Configuration:
|
20
|
+
```
|
21
|
+
{
|
22
|
+
name: 'cascaded-animation',
|
23
|
+
animation: <animation-name>,
|
24
|
+
nodes: <array-of-nodes>,
|
25
|
+
nodedelay: <node-delay-in-ms>,
|
26
|
+
timing: <animation-timing>
|
27
|
+
}
|
28
|
+
```
|
29
|
+
-->
|
30
|
+
|
31
|
+
<script>
|
32
|
+
|
33
|
+
Polymer({
|
34
|
+
|
35
|
+
is: 'cascaded-animation',
|
36
|
+
|
37
|
+
behaviors: [
|
38
|
+
Polymer.NeonAnimationBehavior
|
39
|
+
],
|
40
|
+
|
41
|
+
properties: {
|
42
|
+
|
43
|
+
_animationMeta: {
|
44
|
+
type: Object,
|
45
|
+
value: function() {
|
46
|
+
return new Polymer.IronMeta({type: 'animation'});
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
},
|
51
|
+
|
52
|
+
configure: function(config) {
|
53
|
+
var animationConstructor = this._animationMeta.byKey(config.animation);
|
54
|
+
if (!animationConstructor) {
|
55
|
+
console.warn(this.is + ':', 'constructor for', config.animation, 'not found!');
|
56
|
+
return;
|
57
|
+
}
|
58
|
+
|
59
|
+
var nodes = config.nodes;
|
60
|
+
var effects = [];
|
61
|
+
var nodeDelay = config.nodeDelay || 50;
|
62
|
+
|
63
|
+
config.timing = config.timing || {};
|
64
|
+
config.timing.delay = config.timing.delay || 0;
|
65
|
+
|
66
|
+
var oldDelay = config.timing.delay;
|
67
|
+
for (var node, index = 0; node = nodes[index]; index++) {
|
68
|
+
config.timing.delay += nodeDelay;
|
69
|
+
config.node = node;
|
70
|
+
|
71
|
+
var animation = new animationConstructor();
|
72
|
+
var effect = animation.configure(config);
|
73
|
+
|
74
|
+
effects.push(effect);
|
75
|
+
}
|
76
|
+
config.timing.delay = oldDelay;
|
77
|
+
|
78
|
+
this._effect = new GroupEffect(effects);
|
79
|
+
return this._effect;
|
80
|
+
}
|
81
|
+
|
82
|
+
});
|
83
|
+
|
84
|
+
</script>
|
@@ -0,0 +1,49 @@
|
|
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="../neon-animation-behavior.html">
|
13
|
+
<link rel="import" href="../web-animations.html">
|
14
|
+
|
15
|
+
<!--
|
16
|
+
`<fade-in-animation>` animates the opacity of an element from 0 to 1.
|
17
|
+
|
18
|
+
Configuration:
|
19
|
+
```
|
20
|
+
{
|
21
|
+
name: 'fade-in-animation',
|
22
|
+
node: <node>
|
23
|
+
timing: <animation-timing>
|
24
|
+
}
|
25
|
+
```
|
26
|
+
-->
|
27
|
+
|
28
|
+
<script>
|
29
|
+
|
30
|
+
Polymer({
|
31
|
+
|
32
|
+
is: 'fade-in-animation',
|
33
|
+
|
34
|
+
behaviors: [
|
35
|
+
Polymer.NeonAnimationBehavior
|
36
|
+
],
|
37
|
+
|
38
|
+
configure: function(config) {
|
39
|
+
var node = config.node;
|
40
|
+
this._effect = new KeyframeEffect(node, [
|
41
|
+
{'opacity': '0'},
|
42
|
+
{'opacity': '1'}
|
43
|
+
], this.timingFromConfig(config));
|
44
|
+
return this._effect;
|
45
|
+
}
|
46
|
+
|
47
|
+
});
|
48
|
+
|
49
|
+
</script>
|
@@ -0,0 +1,49 @@
|
|
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="../neon-animation-behavior.html">
|
13
|
+
<link rel="import" href="../web-animations.html">
|
14
|
+
|
15
|
+
<!--
|
16
|
+
`<fade-out-animation>` animates the opacity of an element from 1 to 0.
|
17
|
+
|
18
|
+
Configuration:
|
19
|
+
```
|
20
|
+
{
|
21
|
+
name: 'fade-out-animation',
|
22
|
+
node: <node>
|
23
|
+
timing: <animation-timing>
|
24
|
+
}
|
25
|
+
```
|
26
|
+
-->
|
27
|
+
|
28
|
+
<script>
|
29
|
+
|
30
|
+
Polymer({
|
31
|
+
|
32
|
+
is: 'fade-out-animation',
|
33
|
+
|
34
|
+
behaviors: [
|
35
|
+
Polymer.NeonAnimationBehavior
|
36
|
+
],
|
37
|
+
|
38
|
+
configure: function(config) {
|
39
|
+
var node = config.node;
|
40
|
+
this._effect = new KeyframeEffect(node, [
|
41
|
+
{'opacity': '1'},
|
42
|
+
{'opacity': '0'}
|
43
|
+
], this.timingFromConfig(config));
|
44
|
+
return this._effect;
|
45
|
+
}
|
46
|
+
|
47
|
+
});
|
48
|
+
|
49
|
+
</script>
|
@@ -0,0 +1,83 @@
|
|
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="../neon-shared-element-animation-behavior.html">
|
13
|
+
<link rel="import" href="../web-animations.html">
|
14
|
+
|
15
|
+
<!--
|
16
|
+
`<hero-animation>` is a shared element animation that scales and transform an element such that it
|
17
|
+
appears to be shared between two pages. Use this in `<neon-animated-pages>`. The source page
|
18
|
+
should use this animation in an 'exit' animation and set the `fromPage` configuration property to
|
19
|
+
itself, and the destination page should use this animation in an `entry` animation and set the
|
20
|
+
`toPage` configuration property to itself. They should also define the hero elements in the
|
21
|
+
`sharedElements` property (not a configuration property, see
|
22
|
+
`Polymer.NeonSharedElementAnimatableBehavior`).
|
23
|
+
|
24
|
+
Configuration:
|
25
|
+
```
|
26
|
+
{
|
27
|
+
name: 'hero-animation',
|
28
|
+
id: <shared-element-id>,
|
29
|
+
timing: <animation-timing>,
|
30
|
+
toPage: <node>, /* define for the destination page */
|
31
|
+
fromPage: <node>, /* define for the source page */
|
32
|
+
}
|
33
|
+
```
|
34
|
+
-->
|
35
|
+
|
36
|
+
<script>
|
37
|
+
|
38
|
+
Polymer({
|
39
|
+
|
40
|
+
is: 'hero-animation',
|
41
|
+
|
42
|
+
behaviors: [
|
43
|
+
Polymer.NeonSharedElementAnimationBehavior
|
44
|
+
],
|
45
|
+
|
46
|
+
configure: function(config) {
|
47
|
+
var shared = this.findSharedElements(config);
|
48
|
+
if (!shared) {
|
49
|
+
return null;
|
50
|
+
}
|
51
|
+
|
52
|
+
var fromRect = shared.from.getBoundingClientRect();
|
53
|
+
var toRect = shared.to.getBoundingClientRect();
|
54
|
+
|
55
|
+
var deltaLeft = fromRect.left - toRect.left;
|
56
|
+
var deltaTop = fromRect.top - toRect.top;
|
57
|
+
var deltaWidth = fromRect.width / toRect.width;
|
58
|
+
var deltaHeight = fromRect.height / toRect.height;
|
59
|
+
|
60
|
+
this.setPrefixedProperty(shared.to, 'transformOrigin', '0 0');
|
61
|
+
shared.to.style.zIndex = 10000;
|
62
|
+
shared.from.style.visibility = 'hidden';
|
63
|
+
|
64
|
+
this._effect = new KeyframeEffect(shared.to, [
|
65
|
+
{'transform': 'translate(' + deltaLeft + 'px,' + deltaTop + 'px) scale(' + deltaWidth + ',' + deltaHeight + ')'},
|
66
|
+
{'transform': 'none'}
|
67
|
+
], this.timingFromConfig(config));
|
68
|
+
|
69
|
+
return this._effect;
|
70
|
+
},
|
71
|
+
|
72
|
+
complete: function(config) {
|
73
|
+
var shared = this.findSharedElements(config);
|
74
|
+
if (!shared) {
|
75
|
+
return null;
|
76
|
+
}
|
77
|
+
shared.to.style.zIndex = '';
|
78
|
+
shared.from.style.visibility = '';
|
79
|
+
}
|
80
|
+
|
81
|
+
});
|
82
|
+
|
83
|
+
</script>
|
@@ -0,0 +1,46 @@
|
|
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="../neon-animation-behavior.html">
|
13
|
+
<link rel="import" href="../web-animations.html">
|
14
|
+
|
15
|
+
<!--
|
16
|
+
`<opaque-animation>` makes an element `opacity:1` for the duration of the animation. Used to prevent
|
17
|
+
webkit/safari from drawing a frame before an animation for elements that animate from display:none.
|
18
|
+
-->
|
19
|
+
|
20
|
+
<script>
|
21
|
+
|
22
|
+
Polymer({
|
23
|
+
|
24
|
+
is: 'opaque-animation',
|
25
|
+
|
26
|
+
behaviors: [
|
27
|
+
Polymer.NeonAnimationBehavior
|
28
|
+
],
|
29
|
+
|
30
|
+
configure: function(config) {
|
31
|
+
var node = config.node;
|
32
|
+
node.style.opacity = '0';
|
33
|
+
this._effect = new KeyframeEffect(node, [
|
34
|
+
{'opacity': '1'},
|
35
|
+
{'opacity': '1'}
|
36
|
+
], this.timingFromConfig(config));
|
37
|
+
return this._effect;
|
38
|
+
},
|
39
|
+
|
40
|
+
complete: function(config) {
|
41
|
+
config.node.style.opacity = '';
|
42
|
+
}
|
43
|
+
|
44
|
+
});
|
45
|
+
|
46
|
+
</script>
|
@@ -0,0 +1,92 @@
|
|
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="../neon-shared-element-animation-behavior.html">
|
13
|
+
<link rel="import" href="../web-animations.html">
|
14
|
+
|
15
|
+
<!--
|
16
|
+
`<ripple-animation>` scales and transform an element such that it appears to ripple from either
|
17
|
+
a shared element, or from a screen position, to full screen.
|
18
|
+
|
19
|
+
If using as a shared element animation in `<neon-animated-pages>`, use this animation in an `exit`
|
20
|
+
animation in the source page and in an `entry` animation in the destination page. Also, define the
|
21
|
+
hero elements in the `sharedElements` property (not a configuration property, see
|
22
|
+
`Polymer.NeonSharedElementAnimatableBehavior`).
|
23
|
+
|
24
|
+
If using a screen position, define the `gesture` property.
|
25
|
+
|
26
|
+
Configuration:
|
27
|
+
```
|
28
|
+
{
|
29
|
+
name: 'ripple-animation`.
|
30
|
+
id: <shared-element-id>, /* set this or gesture */
|
31
|
+
gesture: {x: <page-x>, y: <page-y>}, /* set this or id */
|
32
|
+
timing: <animation-timing>,
|
33
|
+
toPage: <node>, /* define for the destination page */
|
34
|
+
fromPage: <node>, /* define for the source page */
|
35
|
+
}
|
36
|
+
```
|
37
|
+
-->
|
38
|
+
|
39
|
+
<script>
|
40
|
+
|
41
|
+
Polymer({
|
42
|
+
|
43
|
+
is: 'ripple-animation',
|
44
|
+
|
45
|
+
behaviors: [
|
46
|
+
Polymer.NeonSharedElementAnimationBehavior
|
47
|
+
],
|
48
|
+
|
49
|
+
configure: function(config, fromPage, toPage) {
|
50
|
+
var shared = this.findSharedElements(config, fromPage, toPage);
|
51
|
+
if (!shared) {
|
52
|
+
return null;
|
53
|
+
}
|
54
|
+
|
55
|
+
var translateX, translateY;
|
56
|
+
var toRect = shared.to.getBoundingClientRect();
|
57
|
+
if (config.gesture) {
|
58
|
+
translateX = config.gesture.x - (toRect.left + (toRect.width / 2));
|
59
|
+
translateY = config.gesture.y - (toRect.left + (toRect.height / 2));
|
60
|
+
} else {
|
61
|
+
var fromRect = shared.from.getBoundingClientRect();
|
62
|
+
translateX = (fromRect.left + (fromRect.width / 2)) - (toRect.left + (toRect.width / 2));
|
63
|
+
translateY = (fromRect.top + (fromRect.height / 2)) - (toRect.left + (toRect.height / 2));
|
64
|
+
}
|
65
|
+
var translate = 'translate(' + translateX + 'px,' + translateY + 'px)';
|
66
|
+
|
67
|
+
var size = Math.max(toRect.width + Math.abs(translateX) * 2, toRect.height + Math.abs(translateY) * 2);
|
68
|
+
var diameter = Math.sqrt(2 * size * size);
|
69
|
+
var scaleX = diameter / toRect.width;
|
70
|
+
var scaleY = diameter / toRect.height;
|
71
|
+
var scale = 'scale(' + scaleX + ',' + scaleY + ')';
|
72
|
+
|
73
|
+
this.setPrefixedProperty(shared.to, 'transformOrigin', '50% 50%');
|
74
|
+
shared.to.style.borderRadius = '50%';
|
75
|
+
|
76
|
+
this._effect = new KeyframeEffect(shared.to, [
|
77
|
+
{'transform': translate + ' scale(0)'},
|
78
|
+
{'transform': translate + ' ' + scale}
|
79
|
+
], this.timingFromConfig(config));
|
80
|
+
return this._effect;
|
81
|
+
},
|
82
|
+
|
83
|
+
complete: function() {
|
84
|
+
if (this.sharedElements) {
|
85
|
+
this.setPrefixedProperty(this.sharedElements.to, 'transformOrigin', '');
|
86
|
+
this.sharedElements.to.style.borderRadius = '';
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
});
|
91
|
+
|
92
|
+
</script>
|