Index: third_party/polymer/components-chromium/core-transition/core-transition-css-extracted.js |
diff --git a/third_party/polymer/components-chromium/core-transition/core-transition-css-extracted.js b/third_party/polymer/components-chromium/core-transition/core-transition-css-extracted.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..07b468b7cf69daf2d5237a45514590030b7c8c9c |
--- /dev/null |
+++ b/third_party/polymer/components-chromium/core-transition/core-transition-css-extracted.js |
@@ -0,0 +1,102 @@ |
+ |
+ |
+ Polymer('core-transition-css', { |
+ |
+ /** |
+ * The class that will be applied to all animated nodes. |
+ * |
+ * @attribute baseClass |
+ * @type string |
+ * @default "core-transition" |
+ */ |
+ baseClass: 'core-transition', |
+ |
+ /** |
+ * The class that will be applied to nodes in the opened state. |
+ * |
+ * @attribute openedClass |
+ * @type string |
+ * @default "core-opened" |
+ */ |
+ openedClass: 'core-opened', |
+ |
+ /** |
+ * The class that will be applied to nodes in the closed state. |
+ * |
+ * @attribute closedClass |
+ * @type string |
+ * @default "core-closed" |
+ */ |
+ closedClass: 'core-closed', |
+ |
+ /** |
+ * Event to listen to for animation completion. |
+ * |
+ * @attribute completeEventName |
+ * @type string |
+ * @default "transitionEnd" |
+ */ |
+ completeEventName: 'transitionend', |
+ |
+ publish: { |
+ /** |
+ * A secondary configuration attribute for the animation. The class |
+ * `<baseClass>-<transitionType` is applied to the animated node during |
+ * `setup`. |
+ * |
+ * @attribute transitionType |
+ * @type string |
+ */ |
+ transitionType: null |
+ }, |
+ |
+ registerCallback: function(element) { |
+ this.transitionStyle = element.templateContent().firstElementChild; |
+ }, |
+ |
+ // template is just for loading styles, we don't need a shadowRoot |
+ fetchTemplate: function() { |
+ return null; |
+ }, |
+ |
+ go: function(node, state) { |
+ if (state.opened !== undefined) { |
+ this.transitionOpened(node, state.opened); |
+ } |
+ }, |
+ |
+ setup: function(node) { |
+ if (!node._hasTransitionStyle) { |
+ if (!node.shadowRoot) { |
+ node.createShadowRoot().innerHTML = '<content></content>'; |
+ } |
+ this.installScopeStyle(this.transitionStyle, 'transition', |
+ node.shadowRoot); |
+ node._hasTransitionStyle = true; |
+ } |
+ node.classList.add(this.baseClass); |
+ if (this.transitionType) { |
+ node.classList.add(this.baseClass + '-' + this.transitionType); |
+ } |
+ }, |
+ |
+ teardown: function(node) { |
+ node.classList.remove(this.baseClass); |
+ if (this.transitionType) { |
+ node.classList.remove(this.baseClass + '-' + this.transitionType); |
+ } |
+ }, |
+ |
+ transitionOpened: function(node, opened) { |
+ this.listenOnce(node, this.completeEventName, function() { |
+ node.classList.toggle(this.revealedClass, opened); |
+ if (!opened) { |
+ node.classList.remove(this.closedClass); |
+ } |
+ this.complete(node); |
+ }); |
+ node.classList.toggle(this.openedClass, opened); |
+ node.classList.toggle(this.closedClass, !opened); |
+ } |
+ |
+ }); |