/usr/share/javascript/yui3/app-transitions/app-transitions.js is in libjs-yui3-full 3.5.1-1ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | /*
YUI 3.5.1 (build 22)
Copyright 2012 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('app-transitions', function(Y) {
/**
Provides view transitions for `Y.App` in browsers which support native CSS3
transitions.
@module app
@submodule app-transitions
@since 3.5.0
**/
/**
Provides view transitions for `Y.App` in browsers which support native CSS3
transitions.
View transitions provide an nice way to move from one "page" to the next that is
both pleasant to the user and helps to communicate a hierarchy between sections
of an application.
When this module is used, it will automatically mix itself in to `Y.App` and
transition between `activeView` changes using the following effects:
* **`fade`**: Cross-fades between the old an new active views.
* **`slideLeft`**: The old and new active views are positioned next to each
other and both slide to the left.
* **`slideRight`**: The old and new active views are positioned next to each
other and both slide to the right.
**Note:** Transitions are an opt-in feature and are enabled via an app's
`transitions` attribute.
@class App.Transitions
@uses App.TransitionsNative
@since 3.5.0
**/
function AppTransitions() {}
AppTransitions.ATTRS = {
/**
Whether or not this application should use view transitions, and if so then
which ones or `true` for the defaults which are specified by the
`transitions` prototype property.
**Note:** Transitions are an opt-in feature and will only be used in
browsers which support native CSS3 transitions.
@attribute transitions
@type Boolean|Object
@default false
@since 3.5.0
**/
transitions: {
setter: '_setTransitions',
value : false
}
};
/**
CSS classes used by `App.Transitions`.
When an app is transitioning between `activeView`s, its `container` node will
have the "yui3-app-transitioning" CSS class added.
@property CLASS_NAMES
@type Object
@static
@since 3.5.0
**/
AppTransitions.CLASS_NAMES = {
transitioning: Y.ClassNameManager.getClassName('app', 'transitioning')
};
/**
Collect of transitions -> fx.
A transition (e.g. "fade") is a simple name given to a configuration of fx to
apply, consisting of `viewIn` and `viewOut` properties who's values are names of
fx registered on `Y.Transition.fx`.
By default transitions: `fade`, `slideLeft`, and `slideRight` have fx defined.
@property FX
@type Object
@static
@since 3.5.0
**/
AppTransitions.FX = {
fade: {
viewIn : 'app:fadeIn',
viewOut: 'app:fadeOut'
},
slideLeft: {
viewIn : 'app:slideLeft',
viewOut: 'app:slideLeft'
},
slideRight: {
viewIn : 'app:slideRight',
viewOut: 'app:slideRight'
}
};
AppTransitions.prototype = {
// -- Public Properties ----------------------------------------------------
/**
Default transitions to use when the `activeView` changes.
The following are types of changes for which transitions can be defined that
correspond to the relationship between the new and previous `activeView`:
* `navigate`: The default transition to use when changing the `activeView`
of the application.
* `toChild`: The transition to use when the new `activeView` is configured
as a child of the previously active view via its `parent` property as
defined in this app's `views`.
* `toParent`: The transition to use when the new `activeView` is
configured as the `parent` of the previously active view as defined in
this app's `views`.
**Note:** Transitions are an opt-in feature and will only be used in
browsers which support native CSS3 transitions.
@property transitions
@type Object
@default
{
navigate: 'fade',
toChild : 'slideLeft',
toParent: 'slideRight'
}
@since 3.5.0
**/
transitions: {
navigate: 'fade',
toChild : 'slideLeft',
toParent: 'slideRight'
},
// -- Public Methods -------------------------------------------------------
/**
Sets which view is active/visible for the application. This will set the
app's `activeView` attribute to the specified `view`.
The `view` will be "attached" to this app, meaning it will be both rendered
into this app's `viewContainer` node and all of its events will bubble to
the app. The previous `activeView` will be "detached" from this app.
When a string-name is provided for a view which has been registered on this
app's `views` object, the referenced metadata will be used and the
`activeView` will be set to either a preserved view instance, or a new
instance of the registered view will be created using the specified `config`
object passed-into this method.
A callback function can be specified as either the third or fourth argument,
and this function will be called after the new `view` becomes the
`activeView`, is rendered to the `viewContainer`, and is ready to use.
@example
var app = new Y.App({
views: {
usersView: {
// Imagine that `Y.UsersView` has been defined.
type: Y.UsersView
}
},
transitions: true,
users : new Y.ModelList()
});
app.route('/users/', function () {
this.showView('usersView', {users: this.get('users')});
});
app.render();
app.navigate('/uses/');
// => Creates a new `Y.UsersView` and transitions to it.
@method showView
@param {String|View} view The name of a view defined in the `views` object,
or a view instance which should become this app's `activeView`.
@param {Object} [config] Optional configuration to use when creating a new
view instance. This config object can also be used to update an existing
or preserved view's attributes when `options.update` is `true`.
@param {Object} [options] Optional object containing any of the following
properties:
@param {Function} [options.callback] Optional callback function to call
after new `activeView` is ready to use, the function will be passed:
@param {View} options.callback.view A reference to the new
`activeView`.
@param {Boolean} [options.prepend=false] Whether the `view` should be
prepended instead of appended to the `viewContainer`.
@param {Boolean} [options.render] Whether the `view` should be rendered.
**Note:** If no value is specified, a view instance will only be
rendered if it's newly created by this method.
@param {Boolean|String} [options.transition] Optional transition override.
A transition can be specified which will override the default, or
`false` for no transition.
@param {Boolean} [options.update=false] Whether an existing view should
have its attributes updated by passing the `config` object to its
`setAttrs()` method. **Note:** This option does not have an effect if
the `view` instance is created as a result of calling this method.
@param {Function} [callback] Optional callback Function to call after the
new `activeView` is ready to use. **Note:** this will override
`options.callback` and it can be specified as either the third or fourth
argument. The function will be passed the following:
@param {View} callback.view A reference to the new `activeView`.
@chainable
@since 3.5.0
**/
// Does not override `showView()` but does use `options.transitions`.
// -- Protected Methods ----------------------------------------------------
/**
Setter for `transitions` attribute.
When specified as `true`, the defaults will be use as specified by the
`transitions` prototype property.
@method _setTransitions
@param {Boolean|Object} transitions The new `transitions` attribute value.
@return {Mixed} The processed value which represents the new state.
@protected
@see App.Base.showView()
@since 3.5.0
**/
_setTransitions: function (transitions) {
var defTransitions = this.transitions;
if (transitions && transitions === true) {
return Y.merge(defTransitions);
}
return transitions;
}
};
// -- Namespace ----------------------------------------------------------------
Y.App.Transitions = AppTransitions;
Y.Base.mix(Y.App, [AppTransitions]);
}, '3.5.1' ,{requires:['app-base']});
|