~ubuntu-branches/ubuntu/quantal/maas/quantal-updates

« back to all changes in this revision

Viewing changes to src/maasserver/static/jslibs/yui/3.4.1/build/transition/transition.js

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-07-03 17:42:37 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20120703174237-p8l0keuuznfg721k
Tags: 0.1+bzr709+dfsg-0ubuntu1
* New Upstream release
* debian/control:
  - Depends on python-celery, python-tempita, libjs-yui3-{full,min},
    libjs-raphael
* debian/maas.install:
  - Install apiclient, celeryconfig.py, maas-import-pxe-files, preseeds_v2.
  - Update to install various files from chroot, rather tha manually copy
    them from the source.
* debian/maas.links: symlink celeryconfig.py
* debian/maas.maas-celery.upstart: Add job.
* debian/rules:
  - Install celery upstart job.
  - Do not install jslibs as packages are now used.
  - Drop copying of maas_local_settings_sample.py as source now ships
    a maas_local_settings.py
* debian/patches:
  - 04-maas-http-fix.patch: Drop. Merged upstream.
  - 01-fix-database-settings.patch: Refreshed.
  - 99_enums_js.patch: Added until creation of enum.js / build process
    is fixed.
* debian/maas.postinst: Update bzr version to correctly handle upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
YUI 3.4.1 (build 4118)
3
 
Copyright 2011 Yahoo! Inc. All rights reserved.
4
 
Licensed under the BSD License.
5
 
http://yuilibrary.com/license/
6
 
*/
7
 
YUI.add('transition', function(Y) {
8
 
 
9
 
/**
10
 
* Provides the transition method for Node.
11
 
* Transition has no API of its own, but adds the transition method to Node.
12
 
*
13
 
* @module transition
14
 
* @requires node-style
15
 
*/
16
 
 
17
 
var CAMEL_VENDOR_PREFIX = '',
18
 
    VENDOR_PREFIX = '',
19
 
    DOCUMENT = Y.config.doc,
20
 
    DOCUMENT_ELEMENT = 'documentElement',
21
 
    TRANSITION = 'transition',
22
 
    TRANSITION_CAMEL = 'Transition',
23
 
    TRANSITION_PROPERTY_CAMEL,
24
 
    TRANSITION_PROPERTY,
25
 
    TRANSITION_DURATION,
26
 
    TRANSITION_TIMING_FUNCTION,
27
 
    TRANSITION_DELAY,
28
 
    TRANSITION_END,
29
 
    ON_TRANSITION_END,
30
 
    TRANSFORM_CAMEL,
31
 
 
32
 
    EMPTY_OBJ = {},
33
 
 
34
 
    VENDORS = [
35
 
        'Webkit',
36
 
        'Moz'
37
 
    ],
38
 
 
39
 
    VENDOR_TRANSITION_END = {
40
 
        Webkit: 'webkitTransitionEnd'
41
 
    },
42
 
 
43
 
/**
44
 
 * A class for constructing transition instances.
45
 
 * Adds the "transition" method to Node.
46
 
 * @class Transition
47
 
 * @constructor
48
 
 */
49
 
 
50
 
Transition = function() {
51
 
    this.init.apply(this, arguments);
52
 
};
53
 
 
54
 
Transition._toCamel = function(property) {
55
 
    property = property.replace(/-([a-z])/gi, function(m0, m1) {
56
 
        return m1.toUpperCase();
57
 
    });
58
 
 
59
 
    return property;
60
 
};
61
 
 
62
 
Transition._toHyphen = function(property) {
63
 
    property = property.replace(/([A-Z]?)([a-z]+)([A-Z]?)/g, function(m0, m1, m2, m3) {
64
 
        var str = ((m1) ? '-' + m1.toLowerCase() : '') + m2;
65
 
        
66
 
        if (m3) {
67
 
            str += '-' + m3.toLowerCase();
68
 
        }
69
 
 
70
 
        return str;
71
 
    }); 
72
 
 
73
 
    return property;
74
 
};
75
 
 
76
 
Transition.SHOW_TRANSITION = 'fadeIn';
77
 
Transition.HIDE_TRANSITION = 'fadeOut';
78
 
 
79
 
Transition.useNative = false;
80
 
 
81
 
Y.Array.each(VENDORS, function(val) { // then vendor specific
82
 
    var property = val + TRANSITION_CAMEL;
83
 
    if (property in DOCUMENT[DOCUMENT_ELEMENT].style) {
84
 
        CAMEL_VENDOR_PREFIX = val;
85
 
        VENDOR_PREFIX = Transition._toHyphen(val) + '-';
86
 
 
87
 
        Transition.useNative = true;
88
 
        Transition.supported = true; // TODO: remove
89
 
        Transition._VENDOR_PREFIX = val;
90
 
    }
91
 
});
92
 
 
93
 
TRANSITION_CAMEL = CAMEL_VENDOR_PREFIX + TRANSITION_CAMEL;
94
 
TRANSITION_PROPERTY_CAMEL = CAMEL_VENDOR_PREFIX + 'TransitionProperty';
95
 
TRANSITION_PROPERTY = VENDOR_PREFIX + 'transition-property';
96
 
TRANSITION_DURATION = VENDOR_PREFIX + 'transition-duration';
97
 
TRANSITION_TIMING_FUNCTION = VENDOR_PREFIX + 'transition-timing-function';
98
 
TRANSITION_DELAY = VENDOR_PREFIX + 'transition-delay';
99
 
TRANSITION_END = 'transitionend';
100
 
ON_TRANSITION_END = 'on' + CAMEL_VENDOR_PREFIX.toLowerCase() + 'transitionend';
101
 
 
102
 
TRANSITION_END = VENDOR_TRANSITION_END[CAMEL_VENDOR_PREFIX] || TRANSITION_END;
103
 
 
104
 
TRANSFORM_CAMEL = CAMEL_VENDOR_PREFIX + 'Transform';
105
 
 
106
 
Transition.fx = {};
107
 
Transition.toggles = {};
108
 
 
109
 
Transition._hasEnd = {};
110
 
 
111
 
Transition._reKeywords = /^(?:node|duration|iterations|easing|delay|on|onstart|onend)$/i;
112
 
 
113
 
Y.Node.DOM_EVENTS[TRANSITION_END] = 1; 
114
 
 
115
 
Transition.NAME = 'transition';
116
 
 
117
 
Transition.DEFAULT_EASING = 'ease';
118
 
Transition.DEFAULT_DURATION = 0.5;
119
 
Transition.DEFAULT_DELAY = 0;
120
 
 
121
 
Transition._nodeAttrs = {};
122
 
 
123
 
Transition.prototype = {
124
 
    constructor: Transition,
125
 
    init: function(node, config) {
126
 
        var anim = this;
127
 
        anim._node = node;
128
 
        if (!anim._running && config) {
129
 
            anim._config = config;
130
 
            node._transition = anim; // cache for reuse
131
 
 
132
 
            anim._duration = ('duration' in config) ?
133
 
                config.duration: anim.constructor.DEFAULT_DURATION;
134
 
 
135
 
            anim._delay = ('delay' in config) ?
136
 
                config.delay: anim.constructor.DEFAULT_DELAY;
137
 
 
138
 
            anim._easing = config.easing || anim.constructor.DEFAULT_EASING;
139
 
            anim._count = 0; // track number of animated properties
140
 
            anim._running = false;
141
 
 
142
 
        }
143
 
 
144
 
        return anim;
145
 
    },
146
 
 
147
 
    addProperty: function(prop, config) {
148
 
        var anim = this,
149
 
            node = this._node,
150
 
            uid = Y.stamp(node),
151
 
            nodeInstance = Y.one(node),
152
 
            attrs = Transition._nodeAttrs[uid],
153
 
            computed,
154
 
            compareVal,
155
 
            dur,
156
 
            attr,
157
 
            val;
158
 
 
159
 
        if (!attrs) {
160
 
            attrs = Transition._nodeAttrs[uid] = {};
161
 
        }
162
 
 
163
 
        attr = attrs[prop];
164
 
 
165
 
        // might just be a value
166
 
        if (config && config.value !== undefined) {
167
 
            val = config.value;
168
 
        } else if (config !== undefined) {
169
 
            val = config; 
170
 
            config = EMPTY_OBJ;
171
 
        }
172
 
 
173
 
        if (typeof val === 'function') {
174
 
            val = val.call(nodeInstance, nodeInstance);
175
 
        }
176
 
 
177
 
        if (attr && attr.transition) {
178
 
            // take control if another transition owns this property
179
 
            if (attr.transition !== anim) {
180
 
                attr.transition._count--; // remapping attr to this transition
181
 
            }
182
 
        } 
183
 
 
184
 
        anim._count++; // properties per transition
185
 
 
186
 
        // make 0 async and fire events
187
 
        dur = ((typeof config.duration != 'undefined') ? config.duration :
188
 
                    anim._duration) || 0.0001;
189
 
 
190
 
        attrs[prop] = {
191
 
            value: val,
192
 
            duration: dur,
193
 
            delay: (typeof config.delay != 'undefined') ? config.delay :
194
 
                    anim._delay,
195
 
 
196
 
            easing: config.easing || anim._easing,
197
 
 
198
 
            transition: anim
199
 
        };
200
 
 
201
 
        // native end event doesnt fire when setting to same value
202
 
        // supplementing with timer
203
 
        // val may be a string or number (height: 0, etc), but computedStyle is always string
204
 
        computed = Y.DOM.getComputedStyle(node, prop);
205
 
        compareVal = (typeof val === 'string') ? computed : parseFloat(computed);
206
 
 
207
 
        if (Transition.useNative && compareVal === val) {
208
 
            setTimeout(function() {
209
 
                anim._onNativeEnd.call(node, {
210
 
                    propertyName: prop,
211
 
                    elapsedTime: dur
212
 
                });
213
 
            }, dur * 1000);
214
 
        }
215
 
    },
216
 
 
217
 
    removeProperty: function(prop) {
218
 
        var anim = this,
219
 
            attrs = Transition._nodeAttrs[Y.stamp(anim._node)];
220
 
 
221
 
        if (attrs && attrs[prop]) {
222
 
            delete attrs[prop];
223
 
            anim._count--;
224
 
        }
225
 
 
226
 
    },
227
 
 
228
 
    initAttrs: function(config) {
229
 
        var attr,
230
 
            node = this._node;
231
 
 
232
 
        if (config.transform && !config[TRANSFORM_CAMEL]) {
233
 
            config[TRANSFORM_CAMEL] = config.transform;
234
 
            delete config.transform; // TODO: copy
235
 
        }
236
 
 
237
 
        for (attr in config) {
238
 
            if (config.hasOwnProperty(attr) && !Transition._reKeywords.test(attr)) {
239
 
                this.addProperty(attr, config[attr]);
240
 
 
241
 
                // when size is auto or % webkit starts from zero instead of computed 
242
 
                // (https://bugs.webkit.org/show_bug.cgi?id=16020)
243
 
                // TODO: selective set
244
 
                if (node.style[attr] === '') {
245
 
                    Y.DOM.setStyle(node, attr, Y.DOM.getComputedStyle(node, attr));
246
 
                }
247
 
            }
248
 
        }
249
 
    },
250
 
 
251
 
    /**
252
 
     * Starts or an animation.
253
 
     * @method run
254
 
     * @chainable
255
 
     * @private
256
 
     */    
257
 
    run: function(callback) {
258
 
        var anim = this,
259
 
            node = anim._node,
260
 
            config = anim._config,
261
 
            data = {
262
 
                type: 'transition:start',
263
 
                config: config
264
 
            };
265
 
 
266
 
 
267
 
        if (!anim._running) {
268
 
            anim._running = true;
269
 
 
270
 
            //anim._node.fire('transition:start', data);
271
 
 
272
 
            if (config.on && config.on.start) {
273
 
                config.on.start.call(Y.one(node), data);
274
 
            }
275
 
 
276
 
            anim.initAttrs(anim._config);
277
 
 
278
 
            anim._callback = callback;
279
 
            anim._start();
280
 
        }
281
 
 
282
 
 
283
 
        return anim;
284
 
    },
285
 
 
286
 
    _start: function() {
287
 
        this._runNative();
288
 
    },
289
 
 
290
 
    _prepDur: function(dur) {
291
 
        dur = parseFloat(dur);
292
 
 
293
 
        return dur + 's';
294
 
    },
295
 
 
296
 
    _runNative: function(time) {
297
 
        var anim = this,
298
 
            node = anim._node,
299
 
            uid = Y.stamp(node),
300
 
            style = node.style,
301
 
            computed = getComputedStyle(node),
302
 
            attrs = Transition._nodeAttrs[uid],
303
 
            cssText = '',
304
 
            cssTransition = computed[Transition._toCamel(TRANSITION_PROPERTY)],
305
 
 
306
 
            transitionText = TRANSITION_PROPERTY + ': ',
307
 
            duration = TRANSITION_DURATION + ': ',
308
 
            easing = TRANSITION_TIMING_FUNCTION + ': ',
309
 
            delay = TRANSITION_DELAY + ': ',
310
 
            hyphy,
311
 
            attr,
312
 
            name;
313
 
 
314
 
        // preserve existing transitions
315
 
        if (cssTransition !== 'all') {
316
 
            transitionText += cssTransition + ',';
317
 
            duration += computed[Transition._toCamel(TRANSITION_DURATION)] + ',';
318
 
            easing += computed[Transition._toCamel(TRANSITION_TIMING_FUNCTION)] + ',';
319
 
            delay += computed[Transition._toCamel(TRANSITION_DELAY)] + ',';
320
 
 
321
 
        }
322
 
 
323
 
        // run transitions mapped to this instance
324
 
        for (name in attrs) {
325
 
            hyphy = Transition._toHyphen(name);
326
 
            attr = attrs[name];
327
 
            if ((attr = attrs[name]) && attr.transition === anim) {
328
 
                if (name in node.style) { // only native styles allowed
329
 
                    duration += anim._prepDur(attr.duration) + ',';
330
 
                    delay += anim._prepDur(attr.delay) + ',';
331
 
                    easing += (attr.easing) + ',';
332
 
 
333
 
                    transitionText += hyphy + ',';
334
 
                    cssText += hyphy + ': ' + attr.value + '; ';
335
 
                } else {
336
 
                    this.removeProperty(name);
337
 
                }
338
 
            }
339
 
        }
340
 
 
341
 
        transitionText = transitionText.replace(/,$/, ';');
342
 
        duration = duration.replace(/,$/, ';');
343
 
        easing = easing.replace(/,$/, ';');
344
 
        delay = delay.replace(/,$/, ';');
345
 
 
346
 
        // only one native end event per node
347
 
        if (!Transition._hasEnd[uid]) {
348
 
            //anim._detach = Y.on(TRANSITION_END, anim._onNativeEnd, node);
349
 
            //node[ON_TRANSITION_END] = anim._onNativeEnd;
350
 
            node.addEventListener(TRANSITION_END, anim._onNativeEnd, '');
351
 
            Transition._hasEnd[uid] = true;
352
 
 
353
 
        }
354
 
        
355
 
        //setTimeout(function() { // allow updates to apply (size fix, onstart, etc)
356
 
            style.cssText += transitionText + duration + easing + delay + cssText;
357
 
        //}, 1);
358
 
 
359
 
    },
360
 
 
361
 
    _end: function(elapsed) {
362
 
        var anim = this,
363
 
            node = anim._node,
364
 
            callback = anim._callback,
365
 
            config = anim._config,
366
 
            data = {
367
 
                type: 'transition:end',
368
 
                config: config,
369
 
                elapsedTime: elapsed 
370
 
            },
371
 
 
372
 
            nodeInstance = Y.one(node); 
373
 
 
374
 
        anim._running = false;
375
 
        anim._callback = null;
376
 
 
377
 
        if (node) {
378
 
            if (config.on && config.on.end) {
379
 
                setTimeout(function() { // IE: allow previous update to finish
380
 
                    config.on.end.call(nodeInstance, data);
381
 
 
382
 
                    // nested to ensure proper fire order
383
 
                    if (callback) {
384
 
                        callback.call(nodeInstance, data);
385
 
                    }
386
 
 
387
 
                }, 1);
388
 
            } else if (callback) {
389
 
                setTimeout(function() { // IE: allow previous update to finish
390
 
                    callback.call(nodeInstance, data);
391
 
                }, 1);
392
 
            }
393
 
            //node.fire('transition:end', data);
394
 
        }
395
 
 
396
 
    },
397
 
 
398
 
    _endNative: function(name) {
399
 
        var node = this._node,
400
 
            value = node.ownerDocument.defaultView.getComputedStyle(node, '')[Transition._toCamel(TRANSITION_PROPERTY)];
401
 
 
402
 
        if (typeof value === 'string') {
403
 
            value = value.replace(new RegExp('(?:^|,\\s)' + name + ',?'), ',');
404
 
            value = value.replace(/^,|,$/, '');
405
 
            node.style[TRANSITION_CAMEL] = value;
406
 
        }
407
 
    },
408
 
 
409
 
    _onNativeEnd: function(e) {
410
 
        var node = this,
411
 
            uid = Y.stamp(node),
412
 
            event = e,//e._event,
413
 
            name = Transition._toCamel(event.propertyName),
414
 
            elapsed = event.elapsedTime,
415
 
            attrs = Transition._nodeAttrs[uid],
416
 
            attr = attrs[name],
417
 
            anim = (attr) ? attr.transition : null,
418
 
            data,
419
 
            config;
420
 
 
421
 
        if (anim) {
422
 
            anim.removeProperty(name);
423
 
            anim._endNative(name);
424
 
            config = anim._config[name];
425
 
 
426
 
            data = {
427
 
                type: 'propertyEnd',
428
 
                propertyName: name,
429
 
                elapsedTime: elapsed,
430
 
                config: config
431
 
            };
432
 
 
433
 
            if (config && config.on && config.on.end) {
434
 
                config.on.end.call(Y.one(node), data);
435
 
            }
436
 
 
437
 
            //node.fire('transition:propertyEnd', data);
438
 
 
439
 
            if (anim._count <= 0)  { // after propertyEnd fires
440
 
                anim._end(elapsed);
441
 
            }
442
 
        }
443
 
    },
444
 
 
445
 
    destroy: function() {
446
 
        var anim = this,
447
 
            node = anim._node;
448
 
        /*
449
 
        if (anim._detach) {
450
 
            anim._detach.detach();
451
 
        }
452
 
        */
453
 
        //anim._node[ON_TRANSITION_END] = null;
454
 
        if (node) {
455
 
            node.removeEventListener(TRANSITION_END, anim._onNativeEnd, false);
456
 
            anim._node = null;
457
 
        }
458
 
    }
459
 
};
460
 
 
461
 
Y.Transition = Transition;
462
 
Y.TransitionNative = Transition; // TODO: remove
463
 
 
464
 
/** 
465
 
 *   Animate one or more css properties to a given value. Requires the "transition" module.
466
 
 *   <pre>example usage:
467
 
 *       Y.one('#demo').transition({
468
 
 *           duration: 1, // in seconds, default is 0.5
469
 
 *           easing: 'ease-out', // default is 'ease'
470
 
 *           delay: '1', // delay start for 1 second, default is 0
471
 
 *
472
 
 *           height: '10px',
473
 
 *           width: '10px',
474
 
 *
475
 
 *           opacity: { // per property
476
 
 *               value: 0,
477
 
 *               duration: 2,
478
 
 *               delay: 2,
479
 
 *               easing: 'ease-in'
480
 
 *           }
481
 
 *       });
482
 
 *   </pre>
483
 
 *   @for Node
484
 
 *   @method transition
485
 
 *   @param {Object} config An object containing one or more style properties, a duration and an easing.
486
 
 *   @param {Function} callback A function to run after the transition has completed. 
487
 
 *   @chainable
488
 
*/
489
 
Y.Node.prototype.transition = function(name, config, callback) {
490
 
    var 
491
 
        transitionAttrs = Transition._nodeAttrs[Y.stamp(this._node)],
492
 
        anim = (transitionAttrs) ? transitionAttrs.transition || null : null,
493
 
        fxConfig,
494
 
        prop;
495
 
    
496
 
    if (typeof name === 'string') { // named effect, pull config from registry
497
 
        if (typeof config === 'function') {
498
 
            callback = config;
499
 
            config = null;
500
 
        }
501
 
 
502
 
        fxConfig = Transition.fx[name];
503
 
 
504
 
        if (config && typeof config !== 'boolean') {
505
 
            config = Y.clone(config);
506
 
 
507
 
            for (prop in fxConfig) {
508
 
                if (fxConfig.hasOwnProperty(prop)) {
509
 
                    if (! (prop in config)) {
510
 
                        config[prop] = fxConfig[prop]; 
511
 
                    }
512
 
                }
513
 
            }
514
 
        } else {
515
 
            config = fxConfig;
516
 
        }
517
 
 
518
 
    } else { // name is a config, config is a callback or undefined
519
 
        callback = config;
520
 
        config = name;
521
 
    }
522
 
 
523
 
    if (anim && !anim._running) {
524
 
        anim.init(this, config);
525
 
    } else {
526
 
        anim = new Transition(this._node, config);
527
 
    }
528
 
 
529
 
    anim.run(callback);
530
 
    return this;
531
 
};
532
 
 
533
 
Y.Node.prototype.show = function(name, config, callback) {
534
 
    this._show(); // show prior to transition
535
 
    if (name && Y.Transition) {
536
 
        if (typeof name !== 'string' && !name.push) { // named effect or array of effects supercedes default
537
 
            if (typeof config === 'function') {
538
 
                callback = config;
539
 
                config = name;
540
 
            }
541
 
            name = Transition.SHOW_TRANSITION; 
542
 
        }    
543
 
        this.transition(name, config, callback);
544
 
    }    
545
 
    return this;
546
 
};
547
 
 
548
 
var _wrapCallBack = function(anim, fn, callback) {
549
 
    return function() {
550
 
        if (fn) {
551
 
            fn.call(anim);
552
 
        }
553
 
        if (callback) {
554
 
            callback.apply(anim._node, arguments);
555
 
        }
556
 
    };
557
 
};
558
 
 
559
 
Y.Node.prototype.hide = function(name, config, callback) {
560
 
    if (name && Y.Transition) {
561
 
        if (typeof config === 'function') {
562
 
            callback = config;
563
 
            config = null;
564
 
        }
565
 
 
566
 
        callback = _wrapCallBack(this, this._hide, callback); // wrap with existing callback
567
 
        if (typeof name !== 'string' && !name.push) { // named effect or array of effects supercedes default
568
 
            if (typeof config === 'function') {
569
 
                callback = config;
570
 
                config = name;
571
 
            }
572
 
            name = Transition.HIDE_TRANSITION; 
573
 
        }    
574
 
        this.transition(name, config, callback);
575
 
    } else {
576
 
        this._hide();
577
 
    }    
578
 
    return this;
579
 
}; 
580
 
 
581
 
/** 
582
 
 *   Animate one or more css properties to a given value. Requires the "transition" module.
583
 
 *   <pre>example usage:
584
 
 *       Y.all('.demo').transition({
585
 
 *           duration: 1, // in seconds, default is 0.5
586
 
 *           easing: 'ease-out', // default is 'ease'
587
 
 *           delay: '1', // delay start for 1 second, default is 0
588
 
 *
589
 
 *           height: '10px',
590
 
 *           width: '10px',
591
 
 *
592
 
 *           opacity: { // per property
593
 
 *               value: 0,
594
 
 *               duration: 2,
595
 
 *               delay: 2,
596
 
 *               easing: 'ease-in'
597
 
 *           }
598
 
 *       });
599
 
 *   </pre>
600
 
 *   @for NodeList
601
 
 *   @method transition
602
 
 *   @param {Object} config An object containing one or more style properties, a duration and an easing.
603
 
 *   @param {Function} callback A function to run after the transition has completed. The callback fires
604
 
 *       once per item in the NodeList.
605
 
 *   @chainable
606
 
*/
607
 
Y.NodeList.prototype.transition = function(config, callback) {
608
 
    var nodes = this._nodes,
609
 
        i = 0,
610
 
        node;
611
 
 
612
 
    while ((node = nodes[i++])) {
613
 
        Y.one(node).transition(config, callback);
614
 
    }
615
 
 
616
 
    return this;
617
 
};
618
 
 
619
 
Y.Node.prototype.toggleView = function(name, on, callback) {
620
 
    this._toggles = this._toggles || [];
621
 
    callback = arguments[arguments.length - 1];
622
 
 
623
 
    if (typeof name == 'boolean') { // no transition, just toggle
624
 
        on = name;
625
 
        name = null;
626
 
    }
627
 
 
628
 
    name = name || Y.Transition.DEFAULT_TOGGLE;
629
 
 
630
 
    if (typeof on == 'undefined' && name in this._toggles) { // reverse current toggle
631
 
        on = ! this._toggles[name];
632
 
    }
633
 
 
634
 
    on = (on) ? 1 : 0;
635
 
    if (on) {
636
 
        this._show();
637
 
    }  else {
638
 
        callback = _wrapCallBack(this, this._hide, callback);
639
 
    }
640
 
 
641
 
    this._toggles[name] = on;
642
 
    this.transition(Y.Transition.toggles[name][on], callback);
643
 
 
644
 
    return this;
645
 
};
646
 
 
647
 
Y.NodeList.prototype.toggleView = function(name, on, callback) {
648
 
    var nodes = this._nodes,
649
 
        i = 0,
650
 
        node;
651
 
 
652
 
    while ((node = nodes[i++])) {
653
 
        Y.one(node).toggleView(name, on, callback);
654
 
    }
655
 
 
656
 
    return this;
657
 
};
658
 
 
659
 
Y.mix(Transition.fx, {
660
 
    fadeOut: {
661
 
        opacity: 0,
662
 
        duration: 0.5,
663
 
        easing: 'ease-out'
664
 
    },
665
 
 
666
 
    fadeIn: {
667
 
        opacity: 1,
668
 
        duration: 0.5,
669
 
        easing: 'ease-in'
670
 
    },
671
 
 
672
 
    sizeOut: {
673
 
        height: 0,
674
 
        width: 0,
675
 
        duration: 0.75,
676
 
        easing: 'ease-out'
677
 
    },
678
 
 
679
 
    sizeIn: {
680
 
        height: function(node) {
681
 
            return node.get('scrollHeight') + 'px';
682
 
        },
683
 
        width: function(node) {
684
 
            return node.get('scrollWidth') + 'px';
685
 
        },
686
 
        duration: 0.5,
687
 
        easing: 'ease-in',
688
 
        
689
 
        on: {
690
 
            start: function() {
691
 
                var overflow = this.getStyle('overflow');
692
 
                if (overflow !== 'hidden') { // enable scrollHeight/Width
693
 
                    this.setStyle('overflow', 'hidden');
694
 
                    this._transitionOverflow = overflow;
695
 
                }
696
 
            },
697
 
 
698
 
            end: function() {
699
 
                if (this._transitionOverflow) { // revert overridden value
700
 
                    this.setStyle('overflow', this._transitionOverflow);
701
 
                    delete this._transitionOverflow;
702
 
                }
703
 
            }
704
 
        } 
705
 
    }
706
 
});
707
 
 
708
 
Y.mix(Transition.toggles, {
709
 
    size: ['sizeOut', 'sizeIn'],
710
 
    fade: ['fadeOut', 'fadeIn']
711
 
});
712
 
 
713
 
Transition.DEFAULT_TOGGLE = 'fade';
714
 
 
715
 
 
716
 
 
717
 
}, '3.4.1' ,{requires:['node-style']});