3 Polymer('core-transition-css', {
6 * The class that will be applied to all animated nodes.
10 * @default "core-transition"
12 baseClass: 'core-transition',
15 * The class that will be applied to nodes in the opened state.
17 * @attribute openedClass
19 * @default "core-opened"
21 openedClass: 'core-opened',
24 * The class that will be applied to nodes in the closed state.
26 * @attribute closedClass
28 * @default "core-closed"
30 closedClass: 'core-closed',
33 * Event to listen to for animation completion.
35 * @attribute completeEventName
37 * @default "transitionEnd"
39 completeEventName: 'transitionend',
43 * A secondary configuration attribute for the animation. The class
44 * `<baseClass>-<transitionType` is applied to the animated node during
47 * @attribute transitionType
53 registerCallback: function(element) {
54 this.transitionStyle = element.templateContent().firstElementChild;
57 // template is just for loading styles, we don't need a shadowRoot
58 fetchTemplate: function() {
62 go: function(node, state) {
63 if (state.opened !== undefined) {
64 this.transitionOpened(node, state.opened);
68 setup: function(node) {
69 if (!node._hasTransitionStyle) {
70 if (!node.shadowRoot) {
71 node.createShadowRoot().innerHTML = '<content></content>';
73 this.installScopeStyle(this.transitionStyle, 'transition',
75 node._hasTransitionStyle = true;
77 node.classList.add(this.baseClass);
78 if (this.transitionType) {
79 node.classList.add(this.baseClass + '-' + this.transitionType);
83 teardown: function(node) {
84 node.classList.remove(this.baseClass);
85 if (this.transitionType) {
86 node.classList.remove(this.baseClass + '-' + this.transitionType);
90 transitionOpened: function(node, opened) {
91 this.listenOnce(node, this.completeEventName, function() {
93 node.classList.remove(this.closedClass);
97 node.classList.toggle(this.openedClass, opened);
98 node.classList.toggle(this.closedClass, !opened);