| Index: third_party/polymer/components-chromium/core-animated-pages/transitions/core-transition-pages-extracted.js
|
| diff --git a/third_party/polymer/components-chromium/core-animated-pages/transitions/core-transition-pages-extracted.js b/third_party/polymer/components-chromium/core-animated-pages/transitions/core-transition-pages-extracted.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..554f71b96c7b1bfa3b48f6b2e71ee1c027cf2a0e
|
| --- /dev/null
|
| +++ b/third_party/polymer/components-chromium/core-animated-pages/transitions/core-transition-pages-extracted.js
|
| @@ -0,0 +1,123 @@
|
| +
|
| +
|
| +(function () {
|
| +
|
| +// create some basic transition styling data.
|
| +var transitions = CoreStyle.g.transitions = CoreStyle.g.transitions || {};
|
| +transitions.duration = '500ms';
|
| +transitions.heroDelay = '50ms';
|
| +transitions.scaleDelay = '500ms';
|
| +transitions.cascadeFadeDuration = '250ms';
|
| +
|
| +Polymer('core-transition-pages',{
|
| +
|
| + publish: {
|
| + /**
|
| + * This class will be applied to the scope element in the `prepare` function.
|
| + * It is removed in the `complete` function. Used to activate a set of CSS
|
| + * rules that need to apply before the transition runs, e.g. a default opacity
|
| + * or transform for the non-active pages.
|
| + *
|
| + * @attribute scopeClass
|
| + * @type string
|
| + * @default ''
|
| + */
|
| + scopeClass: '',
|
| +
|
| + /**
|
| + * This class will be applied to the scope element in the `go` function. It is
|
| + * remoived in the `complete' function. Generally used to apply a CSS transition
|
| + * rule only during the transition.
|
| + *
|
| + * @attribute activeClass
|
| + * @type string
|
| + * @default ''
|
| + */
|
| + activeClass: '',
|
| +
|
| + /**
|
| + * Specifies which CSS property to look for when it receives a `transitionEnd` event
|
| + * to determine whether the transition is complete. If not specified, the first
|
| + * transitionEnd event received will complete the transition.
|
| + *
|
| + * @attribute transitionProperty
|
| + * @type string
|
| + * @default ''
|
| + */
|
| + transitionProperty: ''
|
| + },
|
| +
|
| + /**
|
| + * True if this transition is complete.
|
| + *
|
| + * @attribute completed
|
| + * @type boolean
|
| + * @default false
|
| + */
|
| + completed: false,
|
| +
|
| + prepare: function(scope, options) {
|
| + this.boundCompleteFn = this.complete.bind(this, scope);
|
| + if (this.scopeClass) {
|
| + scope.classList.add(this.scopeClass);
|
| + }
|
| + },
|
| +
|
| + go: function(scope, options) {
|
| + this.completed = false;
|
| + if (this.activeClass) {
|
| + scope.classList.add(this.activeClass);
|
| + }
|
| + scope.addEventListener('transitionend', this.boundCompleteFn, false);
|
| + },
|
| +
|
| + setup: function(scope) {
|
| + if (!scope._pageTransitionStyles) {
|
| + scope._pageTransitionStyles = {};
|
| + }
|
| +
|
| + var name = this.calcStyleName();
|
| +
|
| + if (!scope._pageTransitionStyles[name]) {
|
| + this.installStyleInScope(scope, name);
|
| + scope._pageTransitionStyles[name] = true;
|
| + }
|
| + },
|
| +
|
| + calcStyleName: function() {
|
| + return this.id || this.localName;
|
| + },
|
| +
|
| + installStyleInScope: function(scope, id) {
|
| + if (!scope.shadowRoot) {
|
| + scope.createShadowRoot().innerHTML = '<content></content>';
|
| + }
|
| + var root = scope.shadowRoot;
|
| + var scopeStyle = document.createElement('core-style');
|
| + root.insertBefore(scopeStyle, root.firstChild);
|
| + scopeStyle.applyRef(id);
|
| + },
|
| +
|
| + complete: function(scope, e) {
|
| + // TODO(yvonne): hack, need to manage completion better
|
| + if (e.propertyName !== 'box-shadow' && (!this.transitionProperty || e.propertyName.indexOf(this.transitionProperty) !== -1)) {
|
| + this.completed = true;
|
| + this.fire('core-transitionend', this, scope);
|
| + }
|
| + },
|
| +
|
| + // TODO(sorvell): ideally we do this in complete.
|
| + ensureComplete: function(scope) {
|
| + scope.removeEventListener('transitionend', this.boundCompleteFn, false);
|
| + if (this.scopeClass) {
|
| + scope.classList.remove(this.scopeClass);
|
| + }
|
| + if (this.activeClass) {
|
| + scope.classList.remove(this.activeClass);
|
| + }
|
| + }
|
| +
|
| +});
|
| +
|
| +})();
|
| +
|
|
|