|
1 /* |
|
2 YUI 3.10.3 (build 2fb5187) |
|
3 Copyright 2013 Yahoo! Inc. All rights reserved. |
|
4 Licensed under the BSD License. |
|
5 http://yuilibrary.com/license/ |
|
6 */ |
|
7 |
|
8 /** |
|
9 The YUI module contains the components required for building the YUI seed file. |
|
10 This includes the script loading mechanism, a simple queue, and the core |
|
11 utilities for the library. |
|
12 |
|
13 @module yui |
|
14 @main yui |
|
15 @submodule yui-base |
|
16 **/ |
|
17 |
|
18 /*jshint eqeqeq: false*/ |
|
19 if (typeof YUI != 'undefined') { |
|
20 YUI._YUI = YUI; |
|
21 } |
|
22 |
|
23 /** |
|
24 The YUI global namespace object. This is the constructor for all YUI instances. |
|
25 |
|
26 This is a self-instantiable factory function, meaning you don't need to precede |
|
27 it with the `new` operator. You can invoke it directly like this: |
|
28 |
|
29 YUI().use('*', function (Y) { |
|
30 // Y is a new YUI instance. |
|
31 }); |
|
32 |
|
33 But it also works like this: |
|
34 |
|
35 var Y = YUI(); |
|
36 |
|
37 The `YUI` constructor accepts an optional config object, like this: |
|
38 |
|
39 YUI({ |
|
40 debug: true, |
|
41 combine: false |
|
42 }).use('node', function (Y) { |
|
43 // Y.Node is ready to use. |
|
44 }); |
|
45 |
|
46 See the API docs for the <a href="config.html">Config</a> class for the complete |
|
47 list of supported configuration properties accepted by the YUI constuctor. |
|
48 |
|
49 If a global `YUI` object is already defined, the existing YUI object will not be |
|
50 overwritten, to ensure that defined namespaces are preserved. |
|
51 |
|
52 Each YUI instance has full custom event support, but only if the event system is |
|
53 available. |
|
54 |
|
55 @class YUI |
|
56 @uses EventTarget |
|
57 @constructor |
|
58 @global |
|
59 @param {Object} [config]* Zero or more optional configuration objects. Config |
|
60 values are stored in the `Y.config` property. See the |
|
61 <a href="config.html">Config</a> docs for the list of supported properties. |
|
62 **/ |
|
63 |
|
64 /*global YUI*/ |
|
65 /*global YUI_config*/ |
|
66 var YUI = function() { |
|
67 var i = 0, |
|
68 Y = this, |
|
69 args = arguments, |
|
70 l = args.length, |
|
71 instanceOf = function(o, type) { |
|
72 return (o && o.hasOwnProperty && (o instanceof type)); |
|
73 }, |
|
74 gconf = (typeof YUI_config !== 'undefined') && YUI_config; |
|
75 |
|
76 if (!(instanceOf(Y, YUI))) { |
|
77 Y = new YUI(); |
|
78 } else { |
|
79 // set up the core environment |
|
80 Y._init(); |
|
81 |
|
82 /** |
|
83 Master configuration that might span multiple contexts in a non- |
|
84 browser environment. It is applied first to all instances in all |
|
85 contexts. |
|
86 |
|
87 @example |
|
88 |
|
89 YUI.GlobalConfig = { |
|
90 filter: 'debug' |
|
91 }; |
|
92 |
|
93 YUI().use('node', function (Y) { |
|
94 // debug files used here |
|
95 }); |
|
96 |
|
97 YUI({ |
|
98 filter: 'min' |
|
99 }).use('node', function (Y) { |
|
100 // min files used here |
|
101 }); |
|
102 |
|
103 @property {Object} GlobalConfig |
|
104 @global |
|
105 @static |
|
106 **/ |
|
107 if (YUI.GlobalConfig) { |
|
108 Y.applyConfig(YUI.GlobalConfig); |
|
109 } |
|
110 |
|
111 /** |
|
112 Page-level config applied to all YUI instances created on the |
|
113 current page. This is applied after `YUI.GlobalConfig` and before |
|
114 any instance-level configuration. |
|
115 |
|
116 @example |
|
117 |
|
118 // Single global var to include before YUI seed file |
|
119 YUI_config = { |
|
120 filter: 'debug' |
|
121 }; |
|
122 |
|
123 YUI().use('node', function (Y) { |
|
124 // debug files used here |
|
125 }); |
|
126 |
|
127 YUI({ |
|
128 filter: 'min' |
|
129 }).use('node', function (Y) { |
|
130 // min files used here |
|
131 }); |
|
132 |
|
133 @property {Object} YUI_config |
|
134 @global |
|
135 **/ |
|
136 if (gconf) { |
|
137 Y.applyConfig(gconf); |
|
138 } |
|
139 |
|
140 // bind the specified additional modules for this instance |
|
141 if (!l) { |
|
142 Y._setup(); |
|
143 } |
|
144 } |
|
145 |
|
146 if (l) { |
|
147 // Each instance can accept one or more configuration objects. |
|
148 // These are applied after YUI.GlobalConfig and YUI_Config, |
|
149 // overriding values set in those config files if there is a |
|
150 // matching property. |
|
151 for (; i < l; i++) { |
|
152 Y.applyConfig(args[i]); |
|
153 } |
|
154 |
|
155 Y._setup(); |
|
156 } |
|
157 |
|
158 Y.instanceOf = instanceOf; |
|
159 |
|
160 return Y; |
|
161 }; |
|
162 |
|
163 (function() { |
|
164 |
|
165 var proto, prop, |
|
166 VERSION = '3.10.3', |
|
167 PERIOD = '.', |
|
168 BASE = 'http://yui.yahooapis.com/', |
|
169 /* |
|
170 These CSS class names can't be generated by |
|
171 getClassName since it is not available at the |
|
172 time they are being used. |
|
173 */ |
|
174 DOC_LABEL = 'yui3-js-enabled', |
|
175 CSS_STAMP_EL = 'yui3-css-stamp', |
|
176 NOOP = function() {}, |
|
177 SLICE = Array.prototype.slice, |
|
178 APPLY_TO_AUTH = { 'io.xdrReady': 1, // the functions applyTo |
|
179 'io.xdrResponse': 1, // can call. this should |
|
180 'SWF.eventHandler': 1 }, // be done at build time |
|
181 hasWin = (typeof window != 'undefined'), |
|
182 win = (hasWin) ? window : null, |
|
183 doc = (hasWin) ? win.document : null, |
|
184 docEl = doc && doc.documentElement, |
|
185 docClass = docEl && docEl.className, |
|
186 instances = {}, |
|
187 time = new Date().getTime(), |
|
188 add = function(el, type, fn, capture) { |
|
189 if (el && el.addEventListener) { |
|
190 el.addEventListener(type, fn, capture); |
|
191 } else if (el && el.attachEvent) { |
|
192 el.attachEvent('on' + type, fn); |
|
193 } |
|
194 }, |
|
195 remove = function(el, type, fn, capture) { |
|
196 if (el && el.removeEventListener) { |
|
197 // this can throw an uncaught exception in FF |
|
198 try { |
|
199 el.removeEventListener(type, fn, capture); |
|
200 } catch (ex) {} |
|
201 } else if (el && el.detachEvent) { |
|
202 el.detachEvent('on' + type, fn); |
|
203 } |
|
204 }, |
|
205 handleLoad = function() { |
|
206 YUI.Env.windowLoaded = true; |
|
207 YUI.Env.DOMReady = true; |
|
208 if (hasWin) { |
|
209 remove(window, 'load', handleLoad); |
|
210 } |
|
211 }, |
|
212 getLoader = function(Y, o) { |
|
213 var loader = Y.Env._loader, |
|
214 lCore = [ 'loader-base' ], |
|
215 G_ENV = YUI.Env, |
|
216 mods = G_ENV.mods; |
|
217 |
|
218 if (loader) { |
|
219 //loader._config(Y.config); |
|
220 loader.ignoreRegistered = false; |
|
221 loader.onEnd = null; |
|
222 loader.data = null; |
|
223 loader.required = []; |
|
224 loader.loadType = null; |
|
225 } else { |
|
226 loader = new Y.Loader(Y.config); |
|
227 Y.Env._loader = loader; |
|
228 } |
|
229 if (mods && mods.loader) { |
|
230 lCore = [].concat(lCore, YUI.Env.loaderExtras); |
|
231 } |
|
232 YUI.Env.core = Y.Array.dedupe([].concat(YUI.Env.core, lCore)); |
|
233 |
|
234 return loader; |
|
235 }, |
|
236 |
|
237 clobber = function(r, s) { |
|
238 for (var i in s) { |
|
239 if (s.hasOwnProperty(i)) { |
|
240 r[i] = s[i]; |
|
241 } |
|
242 } |
|
243 }, |
|
244 |
|
245 ALREADY_DONE = { success: true }; |
|
246 |
|
247 // Stamp the documentElement (HTML) with a class of "yui-loaded" to |
|
248 // enable styles that need to key off of JS being enabled. |
|
249 if (docEl && docClass.indexOf(DOC_LABEL) == -1) { |
|
250 if (docClass) { |
|
251 docClass += ' '; |
|
252 } |
|
253 docClass += DOC_LABEL; |
|
254 docEl.className = docClass; |
|
255 } |
|
256 |
|
257 if (VERSION.indexOf('@') > -1) { |
|
258 VERSION = '3.5.0'; // dev time hack for cdn test |
|
259 } |
|
260 |
|
261 proto = { |
|
262 /** |
|
263 Applies a new configuration object to the config of this YUI instance. This |
|
264 will merge new group/module definitions, and will also update the loader |
|
265 cache if necessary. Updating `Y.config` directly will not update the cache. |
|
266 |
|
267 @method applyConfig |
|
268 @param {Object} o the configuration object. |
|
269 @since 3.2.0 |
|
270 **/ |
|
271 applyConfig: function(o) { |
|
272 |
|
273 o = o || NOOP; |
|
274 |
|
275 var attr, |
|
276 name, |
|
277 // detail, |
|
278 config = this.config, |
|
279 mods = config.modules, |
|
280 groups = config.groups, |
|
281 aliases = config.aliases, |
|
282 loader = this.Env._loader; |
|
283 |
|
284 for (name in o) { |
|
285 if (o.hasOwnProperty(name)) { |
|
286 attr = o[name]; |
|
287 if (mods && name == 'modules') { |
|
288 clobber(mods, attr); |
|
289 } else if (aliases && name == 'aliases') { |
|
290 clobber(aliases, attr); |
|
291 } else if (groups && name == 'groups') { |
|
292 clobber(groups, attr); |
|
293 } else if (name == 'win') { |
|
294 config[name] = (attr && attr.contentWindow) || attr; |
|
295 config.doc = config[name] ? config[name].document : null; |
|
296 } else if (name == '_yuid') { |
|
297 // preserve the guid |
|
298 } else { |
|
299 config[name] = attr; |
|
300 } |
|
301 } |
|
302 } |
|
303 |
|
304 if (loader) { |
|
305 loader._config(o); |
|
306 } |
|
307 |
|
308 }, |
|
309 |
|
310 /** |
|
311 Old way to apply a config to this instance (calls `applyConfig` under the |
|
312 hood). |
|
313 |
|
314 @private |
|
315 @method _config |
|
316 @param {Object} o The config to apply |
|
317 **/ |
|
318 _config: function(o) { |
|
319 this.applyConfig(o); |
|
320 }, |
|
321 |
|
322 /** |
|
323 Initializes this YUI instance. |
|
324 |
|
325 @private |
|
326 @method _init |
|
327 **/ |
|
328 _init: function() { |
|
329 var filter, el, |
|
330 Y = this, |
|
331 G_ENV = YUI.Env, |
|
332 Env = Y.Env, |
|
333 prop; |
|
334 |
|
335 /** |
|
336 The version number of this YUI instance. |
|
337 |
|
338 This value is typically updated by a script when a YUI release is built, |
|
339 so it may not reflect the correct version number when YUI is run from |
|
340 the development source tree. |
|
341 |
|
342 @property {String} version |
|
343 **/ |
|
344 Y.version = VERSION; |
|
345 |
|
346 if (!Env) { |
|
347 Y.Env = { |
|
348 core: ['get', 'features', 'intl-base', 'yui-log', 'yui-log-nodejs', 'yui-later', 'loader-base', 'loader-rollup', 'loader-yui3'], |
|
349 loaderExtras: ['loader-rollup', 'loader-yui3'], |
|
350 mods: {}, // flat module map |
|
351 versions: {}, // version module map |
|
352 base: BASE, |
|
353 cdn: BASE + VERSION + '/build/', |
|
354 // bootstrapped: false, |
|
355 _idx: 0, |
|
356 _used: {}, |
|
357 _attached: {}, |
|
358 _missed: [], |
|
359 _yidx: 0, |
|
360 _uidx: 0, |
|
361 _guidp: 'y', |
|
362 _loaded: {}, |
|
363 // serviced: {}, |
|
364 // Regex in English: |
|
365 // I'll start at the \b(simpleyui). |
|
366 // 1. Look in the test string for "simpleyui" or "yui" or |
|
367 // "yui-base" or "yui-davglass" or "yui-foobar" that comes after a word break. That is, it |
|
368 // can't match "foyui" or "i_heart_simpleyui". This can be anywhere in the string. |
|
369 // 2. After #1 must come a forward slash followed by the string matched in #1, so |
|
370 // "yui-base/yui-base" or "simpleyui/simpleyui" or "yui-pants/yui-pants". |
|
371 // 3. The second occurence of the #1 token can optionally be followed by "-debug" or "-min", |
|
372 // so "yui/yui-min", "yui/yui-debug", "yui-base/yui-base-debug". NOT "yui/yui-tshirt". |
|
373 // 4. This is followed by ".js", so "yui/yui.js", "simpleyui/simpleyui-min.js" |
|
374 // 0. Going back to the beginning, now. If all that stuff in 1-4 comes after a "?" in the string, |
|
375 // then capture the junk between the LAST "&" and the string in 1-4. So |
|
376 // "blah?foo/yui/yui.js" will capture "foo/" and "blah?some/thing.js&3.3.0/build/yui-davglass/yui-davglass.js" |
|
377 // will capture "3.3.0/build/" |
|
378 // |
|
379 // Regex Exploded: |
|
380 // (?:\? Find a ? |
|
381 // (?:[^&]*&) followed by 0..n characters followed by an & |
|
382 // * in fact, find as many sets of characters followed by a & as you can |
|
383 // ([^&]*) capture the stuff after the last & in \1 |
|
384 // )? but it's ok if all this ?junk&more_junk stuff isn't even there |
|
385 // \b(simpleyui| after a word break find either the string "simpleyui" or |
|
386 // yui(?:-\w+)? the string "yui" optionally followed by a -, then more characters |
|
387 // ) and store the simpleyui or yui-* string in \2 |
|
388 // \/\2 then comes a / followed by the simpleyui or yui-* string in \2 |
|
389 // (?:-(min|debug))? optionally followed by "-min" or "-debug" |
|
390 // .js and ending in ".js" |
|
391 _BASE_RE: /(?:\?(?:[^&]*&)*([^&]*))?\b(simpleyui|yui(?:-\w+)?)\/\2(?:-(min|debug))?\.js/, |
|
392 parseBasePath: function(src, pattern) { |
|
393 var match = src.match(pattern), |
|
394 path, filter; |
|
395 |
|
396 if (match) { |
|
397 path = RegExp.leftContext || src.slice(0, src.indexOf(match[0])); |
|
398 |
|
399 // this is to set up the path to the loader. The file |
|
400 // filter for loader should match the yui include. |
|
401 filter = match[3]; |
|
402 |
|
403 // extract correct path for mixed combo urls |
|
404 // http://yuilibrary.com/projects/yui3/ticket/2528423 |
|
405 if (match[1]) { |
|
406 path += '?' + match[1]; |
|
407 } |
|
408 path = { |
|
409 filter: filter, |
|
410 path: path |
|
411 }; |
|
412 } |
|
413 return path; |
|
414 }, |
|
415 getBase: G_ENV && G_ENV.getBase || |
|
416 function(pattern) { |
|
417 var nodes = (doc && doc.getElementsByTagName('script')) || [], |
|
418 path = Env.cdn, parsed, |
|
419 i, len, src; |
|
420 |
|
421 for (i = 0, len = nodes.length; i < len; ++i) { |
|
422 src = nodes[i].src; |
|
423 if (src) { |
|
424 parsed = Y.Env.parseBasePath(src, pattern); |
|
425 if (parsed) { |
|
426 filter = parsed.filter; |
|
427 path = parsed.path; |
|
428 break; |
|
429 } |
|
430 } |
|
431 } |
|
432 |
|
433 // use CDN default |
|
434 return path; |
|
435 } |
|
436 |
|
437 }; |
|
438 |
|
439 Env = Y.Env; |
|
440 |
|
441 Env._loaded[VERSION] = {}; |
|
442 |
|
443 if (G_ENV && Y !== YUI) { |
|
444 Env._yidx = ++G_ENV._yidx; |
|
445 Env._guidp = ('yui_' + VERSION + '_' + |
|
446 Env._yidx + '_' + time).replace(/[^a-z0-9_]+/g, '_'); |
|
447 } else if (YUI._YUI) { |
|
448 |
|
449 G_ENV = YUI._YUI.Env; |
|
450 Env._yidx += G_ENV._yidx; |
|
451 Env._uidx += G_ENV._uidx; |
|
452 |
|
453 for (prop in G_ENV) { |
|
454 if (!(prop in Env)) { |
|
455 Env[prop] = G_ENV[prop]; |
|
456 } |
|
457 } |
|
458 |
|
459 delete YUI._YUI; |
|
460 } |
|
461 |
|
462 Y.id = Y.stamp(Y); |
|
463 instances[Y.id] = Y; |
|
464 |
|
465 } |
|
466 |
|
467 Y.constructor = YUI; |
|
468 |
|
469 // configuration defaults |
|
470 Y.config = Y.config || { |
|
471 bootstrap: true, |
|
472 cacheUse: true, |
|
473 debug: true, |
|
474 doc: doc, |
|
475 fetchCSS: true, |
|
476 throwFail: true, |
|
477 useBrowserConsole: true, |
|
478 useNativeES5: true, |
|
479 win: win, |
|
480 global: Function('return this')() |
|
481 }; |
|
482 |
|
483 //Register the CSS stamp element |
|
484 if (doc && !doc.getElementById(CSS_STAMP_EL)) { |
|
485 el = doc.createElement('div'); |
|
486 el.innerHTML = '<div id="' + CSS_STAMP_EL + '" style="position: absolute !important; visibility: hidden !important"></div>'; |
|
487 YUI.Env.cssStampEl = el.firstChild; |
|
488 if (doc.body) { |
|
489 doc.body.appendChild(YUI.Env.cssStampEl); |
|
490 } else { |
|
491 docEl.insertBefore(YUI.Env.cssStampEl, docEl.firstChild); |
|
492 } |
|
493 } else if (doc && doc.getElementById(CSS_STAMP_EL) && !YUI.Env.cssStampEl) { |
|
494 YUI.Env.cssStampEl = doc.getElementById(CSS_STAMP_EL); |
|
495 } |
|
496 |
|
497 Y.config.lang = Y.config.lang || 'en-US'; |
|
498 |
|
499 Y.config.base = YUI.config.base || Y.Env.getBase(Y.Env._BASE_RE); |
|
500 |
|
501 if (!filter || (!('mindebug').indexOf(filter))) { |
|
502 filter = 'min'; |
|
503 } |
|
504 filter = (filter) ? '-' + filter : filter; |
|
505 Y.config.loaderPath = YUI.config.loaderPath || 'loader/loader' + filter + '.js'; |
|
506 |
|
507 }, |
|
508 |
|
509 /** |
|
510 Finishes the instance setup. Attaches whatever YUI modules were defined |
|
511 at the time that this instance was created. |
|
512 |
|
513 @method _setup |
|
514 @private |
|
515 **/ |
|
516 _setup: function() { |
|
517 var i, Y = this, |
|
518 core = [], |
|
519 mods = YUI.Env.mods, |
|
520 extras = Y.config.core || [].concat(YUI.Env.core); //Clone it.. |
|
521 |
|
522 for (i = 0; i < extras.length; i++) { |
|
523 if (mods[extras[i]]) { |
|
524 core.push(extras[i]); |
|
525 } |
|
526 } |
|
527 |
|
528 Y._attach(['yui-base']); |
|
529 Y._attach(core); |
|
530 |
|
531 if (Y.Loader) { |
|
532 getLoader(Y); |
|
533 } |
|
534 |
|
535 }, |
|
536 |
|
537 /** |
|
538 Executes the named method on the specified YUI instance if that method is |
|
539 whitelisted. |
|
540 |
|
541 @method applyTo |
|
542 @param {String} id YUI instance id. |
|
543 @param {String} method Name of the method to execute. For example: |
|
544 'Object.keys'. |
|
545 @param {Array} args Arguments to apply to the method. |
|
546 @return {Mixed} Return value from the applied method, or `null` if the |
|
547 specified instance was not found or the method was not whitelisted. |
|
548 **/ |
|
549 applyTo: function(id, method, args) { |
|
550 if (!(method in APPLY_TO_AUTH)) { |
|
551 this.log(method + ': applyTo not allowed', 'warn', 'yui'); |
|
552 return null; |
|
553 } |
|
554 |
|
555 var instance = instances[id], nest, m, i; |
|
556 if (instance) { |
|
557 nest = method.split('.'); |
|
558 m = instance; |
|
559 for (i = 0; i < nest.length; i = i + 1) { |
|
560 m = m[nest[i]]; |
|
561 if (!m) { |
|
562 this.log('applyTo not found: ' + method, 'warn', 'yui'); |
|
563 } |
|
564 } |
|
565 return m && m.apply(instance, args); |
|
566 } |
|
567 |
|
568 return null; |
|
569 }, |
|
570 |
|
571 /** |
|
572 Registers a YUI module and makes it available for use in a `YUI().use()` call or |
|
573 as a dependency for other modules. |
|
574 |
|
575 The easiest way to create a first-class YUI module is to use |
|
576 <a href="http://yui.github.com/shifter/">Shifter</a>, the YUI component build |
|
577 tool. |
|
578 |
|
579 Shifter will automatically wrap your module code in a `YUI.add()` call along |
|
580 with any configuration info required for the module. |
|
581 |
|
582 @example |
|
583 |
|
584 YUI.add('davglass', function (Y) { |
|
585 Y.davglass = function () { |
|
586 }; |
|
587 }, '3.4.0', { |
|
588 requires: ['harley-davidson', 'mt-dew'] |
|
589 }); |
|
590 |
|
591 @method add |
|
592 @param {String} name Module name. |
|
593 @param {Function} fn Function containing module code. This function will be |
|
594 executed whenever the module is attached to a specific YUI instance. |
|
595 |
|
596 @param {YUI} fn.Y The YUI instance to which this module is attached. |
|
597 @param {String} fn.name Name of the module |
|
598 |
|
599 @param {String} version Module version number. This is currently used only for |
|
600 informational purposes, and is not used internally by YUI. |
|
601 |
|
602 @param {Object} [config] Module config. |
|
603 @param {Array} [config.requires] Array of other module names that must be |
|
604 attached before this module can be attached. |
|
605 @param {Array} [config.optional] Array of optional module names that should |
|
606 be attached before this module is attached if they've already been |
|
607 loaded. If the `loadOptional` YUI option is `true`, optional modules |
|
608 that have not yet been loaded will be loaded just as if they were hard |
|
609 requirements. |
|
610 @param {Array} [config.use] Array of module names that are included within |
|
611 or otherwise provided by this module, and which should be attached |
|
612 automatically when this module is attached. This makes it possible to |
|
613 create "virtual rollup" modules that simply attach a collection of other |
|
614 modules or submodules. |
|
615 |
|
616 @return {YUI} This YUI instance. |
|
617 **/ |
|
618 add: function(name, fn, version, details) { |
|
619 details = details || {}; |
|
620 var env = YUI.Env, |
|
621 mod = { |
|
622 name: name, |
|
623 fn: fn, |
|
624 version: version, |
|
625 details: details |
|
626 }, |
|
627 //Instance hash so we don't apply it to the same instance twice |
|
628 applied = {}, |
|
629 loader, inst, |
|
630 i, versions = env.versions; |
|
631 |
|
632 env.mods[name] = mod; |
|
633 versions[version] = versions[version] || {}; |
|
634 versions[version][name] = mod; |
|
635 |
|
636 for (i in instances) { |
|
637 if (instances.hasOwnProperty(i)) { |
|
638 inst = instances[i]; |
|
639 if (!applied[inst.id]) { |
|
640 applied[inst.id] = true; |
|
641 loader = inst.Env._loader; |
|
642 if (loader) { |
|
643 if (!loader.moduleInfo[name] || loader.moduleInfo[name].temp) { |
|
644 loader.addModule(details, name); |
|
645 } |
|
646 } |
|
647 } |
|
648 } |
|
649 } |
|
650 |
|
651 return this; |
|
652 }, |
|
653 |
|
654 /** |
|
655 Executes the callback function associated with each required module, |
|
656 attaching the module to this YUI instance. |
|
657 |
|
658 @method _attach |
|
659 @param {Array} r The array of modules to attach |
|
660 @param {Boolean} [moot=false] If `true`, don't throw a warning if the module |
|
661 is not attached. |
|
662 @private |
|
663 **/ |
|
664 _attach: function(r, moot) { |
|
665 var i, name, mod, details, req, use, after, |
|
666 mods = YUI.Env.mods, |
|
667 aliases = YUI.Env.aliases, |
|
668 Y = this, j, |
|
669 cache = YUI.Env._renderedMods, |
|
670 loader = Y.Env._loader, |
|
671 done = Y.Env._attached, |
|
672 len = r.length, loader, def, go, |
|
673 c = []; |
|
674 |
|
675 //Check for conditional modules (in a second+ instance) and add their requirements |
|
676 //TODO I hate this entire method, it needs to be fixed ASAP (3.5.0) ^davglass |
|
677 for (i = 0; i < len; i++) { |
|
678 name = r[i]; |
|
679 mod = mods[name]; |
|
680 c.push(name); |
|
681 if (loader && loader.conditions[name]) { |
|
682 for (j in loader.conditions[name]) { |
|
683 if (loader.conditions[name].hasOwnProperty(j)) { |
|
684 def = loader.conditions[name][j]; |
|
685 go = def && ((def.ua && Y.UA[def.ua]) || (def.test && def.test(Y))); |
|
686 if (go) { |
|
687 c.push(def.name); |
|
688 } |
|
689 } |
|
690 } |
|
691 } |
|
692 } |
|
693 r = c; |
|
694 len = r.length; |
|
695 |
|
696 for (i = 0; i < len; i++) { |
|
697 if (!done[r[i]]) { |
|
698 name = r[i]; |
|
699 mod = mods[name]; |
|
700 |
|
701 if (aliases && aliases[name] && !mod) { |
|
702 Y._attach(aliases[name]); |
|
703 continue; |
|
704 } |
|
705 if (!mod) { |
|
706 if (loader && loader.moduleInfo[name]) { |
|
707 mod = loader.moduleInfo[name]; |
|
708 moot = true; |
|
709 } |
|
710 |
|
711 |
|
712 //if (!loader || !loader.moduleInfo[name]) { |
|
713 //if ((!loader || !loader.moduleInfo[name]) && !moot) { |
|
714 if (!moot && name) { |
|
715 if ((name.indexOf('skin-') === -1) && (name.indexOf('css') === -1)) { |
|
716 Y.Env._missed.push(name); |
|
717 Y.Env._missed = Y.Array.dedupe(Y.Env._missed); |
|
718 Y.message('NOT loaded: ' + name, 'warn', 'yui'); |
|
719 } |
|
720 } |
|
721 } else { |
|
722 done[name] = true; |
|
723 //Don't like this, but in case a mod was asked for once, then we fetch it |
|
724 //We need to remove it from the missed list ^davglass |
|
725 for (j = 0; j < Y.Env._missed.length; j++) { |
|
726 if (Y.Env._missed[j] === name) { |
|
727 Y.message('Found: ' + name + ' (was reported as missing earlier)', 'warn', 'yui'); |
|
728 Y.Env._missed.splice(j, 1); |
|
729 } |
|
730 } |
|
731 /* |
|
732 If it's a temp module, we need to redo it's requirements if it's already loaded |
|
733 since it may have been loaded by another instance and it's dependencies might |
|
734 have been redefined inside the fetched file. |
|
735 */ |
|
736 if (loader && cache && cache[name] && cache[name].temp) { |
|
737 loader.getRequires(cache[name]); |
|
738 req = []; |
|
739 for (j in loader.moduleInfo[name].expanded_map) { |
|
740 if (loader.moduleInfo[name].expanded_map.hasOwnProperty(j)) { |
|
741 req.push(j); |
|
742 } |
|
743 } |
|
744 Y._attach(req); |
|
745 } |
|
746 |
|
747 details = mod.details; |
|
748 req = details.requires; |
|
749 use = details.use; |
|
750 after = details.after; |
|
751 //Force Intl load if there is a language (Loader logic) @todo fix this shit |
|
752 if (details.lang) { |
|
753 req = req || []; |
|
754 req.unshift('intl'); |
|
755 } |
|
756 |
|
757 if (req) { |
|
758 for (j = 0; j < req.length; j++) { |
|
759 if (!done[req[j]]) { |
|
760 if (!Y._attach(req)) { |
|
761 return false; |
|
762 } |
|
763 break; |
|
764 } |
|
765 } |
|
766 } |
|
767 |
|
768 if (after) { |
|
769 for (j = 0; j < after.length; j++) { |
|
770 if (!done[after[j]]) { |
|
771 if (!Y._attach(after, true)) { |
|
772 return false; |
|
773 } |
|
774 break; |
|
775 } |
|
776 } |
|
777 } |
|
778 |
|
779 if (mod.fn) { |
|
780 if (Y.config.throwFail) { |
|
781 mod.fn(Y, name); |
|
782 } else { |
|
783 try { |
|
784 mod.fn(Y, name); |
|
785 } catch (e) { |
|
786 Y.error('Attach error: ' + name, e, name); |
|
787 return false; |
|
788 } |
|
789 } |
|
790 } |
|
791 |
|
792 if (use) { |
|
793 for (j = 0; j < use.length; j++) { |
|
794 if (!done[use[j]]) { |
|
795 if (!Y._attach(use)) { |
|
796 return false; |
|
797 } |
|
798 break; |
|
799 } |
|
800 } |
|
801 } |
|
802 |
|
803 |
|
804 |
|
805 } |
|
806 } |
|
807 } |
|
808 |
|
809 return true; |
|
810 }, |
|
811 |
|
812 /** |
|
813 Delays the `use` callback until another event has taken place such as |
|
814 `window.onload`, `domready`, `contentready`, or `available`. |
|
815 |
|
816 @private |
|
817 @method _delayCallback |
|
818 @param {Function} cb The original `use` callback. |
|
819 @param {String|Object} until Either an event name ('load', 'domready', etc.) |
|
820 or an object containing event/args keys for contentready/available. |
|
821 @return {Function} |
|
822 **/ |
|
823 _delayCallback: function(cb, until) { |
|
824 |
|
825 var Y = this, |
|
826 mod = ['event-base']; |
|
827 |
|
828 until = (Y.Lang.isObject(until) ? until : { event: until }); |
|
829 |
|
830 if (until.event === 'load') { |
|
831 mod.push('event-synthetic'); |
|
832 } |
|
833 |
|
834 return function() { |
|
835 var args = arguments; |
|
836 Y._use(mod, function() { |
|
837 Y.on(until.event, function() { |
|
838 args[1].delayUntil = until.event; |
|
839 cb.apply(Y, args); |
|
840 }, until.args); |
|
841 }); |
|
842 }; |
|
843 }, |
|
844 |
|
845 /** |
|
846 Attaches one or more modules to this YUI instance. When this is executed, |
|
847 the requirements of the desired modules are analyzed, and one of several |
|
848 things can happen: |
|
849 |
|
850 |
|
851 * All required modules have already been loaded, and just need to be |
|
852 attached to this YUI instance. In this case, the `use()` callback will |
|
853 be executed synchronously after the modules are attached. |
|
854 |
|
855 * One or more modules have not yet been loaded, or the Get utility is not |
|
856 available, or the `bootstrap` config option is `false`. In this case, |
|
857 a warning is issued indicating that modules are missing, but all |
|
858 available modules will still be attached and the `use()` callback will |
|
859 be executed synchronously. |
|
860 |
|
861 * One or more modules are missing and the Loader is not available but the |
|
862 Get utility is, and `bootstrap` is not `false`. In this case, the Get |
|
863 utility will be used to load the Loader, and we will then proceed to |
|
864 the following state: |
|
865 |
|
866 * One or more modules are missing and the Loader is available. In this |
|
867 case, the Loader will be used to resolve the dependency tree for the |
|
868 missing modules and load them and their dependencies. When the Loader is |
|
869 finished loading modules, the `use()` callback will be executed |
|
870 asynchronously. |
|
871 |
|
872 @example |
|
873 |
|
874 // Loads and attaches dd and its dependencies. |
|
875 YUI().use('dd', function (Y) { |
|
876 // ... |
|
877 }); |
|
878 |
|
879 // Loads and attaches dd and node as well as all of their dependencies. |
|
880 YUI().use(['dd', 'node'], function (Y) { |
|
881 // ... |
|
882 }); |
|
883 |
|
884 // Attaches all modules that have already been loaded. |
|
885 YUI().use('*', function (Y) { |
|
886 // ... |
|
887 }); |
|
888 |
|
889 // Attaches a gallery module. |
|
890 YUI().use('gallery-yql', function (Y) { |
|
891 // ... |
|
892 }); |
|
893 |
|
894 // Attaches a YUI 2in3 module. |
|
895 YUI().use('yui2-datatable', function (Y) { |
|
896 // ... |
|
897 }); |
|
898 |
|
899 @method use |
|
900 @param {String|Array} modules* One or more module names to attach. |
|
901 @param {Function} [callback] Callback function to be executed once all |
|
902 specified modules and their dependencies have been attached. |
|
903 @param {YUI} callback.Y The YUI instance created for this sandbox. |
|
904 @param {Object} callback.status Object containing `success`, `msg` and |
|
905 `data` properties. |
|
906 @chainable |
|
907 **/ |
|
908 use: function() { |
|
909 var args = SLICE.call(arguments, 0), |
|
910 callback = args[args.length - 1], |
|
911 Y = this, |
|
912 i = 0, |
|
913 name, |
|
914 Env = Y.Env, |
|
915 provisioned = true; |
|
916 |
|
917 // The last argument supplied to use can be a load complete callback |
|
918 if (Y.Lang.isFunction(callback)) { |
|
919 args.pop(); |
|
920 if (Y.config.delayUntil) { |
|
921 callback = Y._delayCallback(callback, Y.config.delayUntil); |
|
922 } |
|
923 } else { |
|
924 callback = null; |
|
925 } |
|
926 if (Y.Lang.isArray(args[0])) { |
|
927 args = args[0]; |
|
928 } |
|
929 |
|
930 if (Y.config.cacheUse) { |
|
931 while ((name = args[i++])) { |
|
932 if (!Env._attached[name]) { |
|
933 provisioned = false; |
|
934 break; |
|
935 } |
|
936 } |
|
937 |
|
938 if (provisioned) { |
|
939 if (args.length) { |
|
940 } |
|
941 Y._notify(callback, ALREADY_DONE, args); |
|
942 return Y; |
|
943 } |
|
944 } |
|
945 |
|
946 if (Y._loading) { |
|
947 Y._useQueue = Y._useQueue || new Y.Queue(); |
|
948 Y._useQueue.add([args, callback]); |
|
949 } else { |
|
950 Y._use(args, function(Y, response) { |
|
951 Y._notify(callback, response, args); |
|
952 }); |
|
953 } |
|
954 |
|
955 return Y; |
|
956 }, |
|
957 |
|
958 /** |
|
959 Handles Loader notifications about attachment/load errors. |
|
960 |
|
961 @method _notify |
|
962 @param {Function} callback Callback to pass to `Y.config.loadErrorFn`. |
|
963 @param {Object} response Response returned from Loader. |
|
964 @param {Array} args Arguments passed from Loader. |
|
965 @private |
|
966 **/ |
|
967 _notify: function(callback, response, args) { |
|
968 if (!response.success && this.config.loadErrorFn) { |
|
969 this.config.loadErrorFn.call(this, this, callback, response, args); |
|
970 } else if (callback) { |
|
971 if (this.Env._missed && this.Env._missed.length) { |
|
972 response.msg = 'Missing modules: ' + this.Env._missed.join(); |
|
973 response.success = false; |
|
974 } |
|
975 if (this.config.throwFail) { |
|
976 callback(this, response); |
|
977 } else { |
|
978 try { |
|
979 callback(this, response); |
|
980 } catch (e) { |
|
981 this.error('use callback error', e, args); |
|
982 } |
|
983 } |
|
984 } |
|
985 }, |
|
986 |
|
987 /** |
|
988 Called from the `use` method queue to ensure that only one set of loading |
|
989 logic is performed at a time. |
|
990 |
|
991 @method _use |
|
992 @param {String} args* One or more modules to attach. |
|
993 @param {Function} [callback] Function to call once all required modules have |
|
994 been attached. |
|
995 @private |
|
996 **/ |
|
997 _use: function(args, callback) { |
|
998 |
|
999 if (!this.Array) { |
|
1000 this._attach(['yui-base']); |
|
1001 } |
|
1002 |
|
1003 var len, loader, handleBoot, |
|
1004 Y = this, |
|
1005 G_ENV = YUI.Env, |
|
1006 mods = G_ENV.mods, |
|
1007 Env = Y.Env, |
|
1008 used = Env._used, |
|
1009 aliases = G_ENV.aliases, |
|
1010 queue = G_ENV._loaderQueue, |
|
1011 firstArg = args[0], |
|
1012 YArray = Y.Array, |
|
1013 config = Y.config, |
|
1014 boot = config.bootstrap, |
|
1015 missing = [], |
|
1016 i, |
|
1017 r = [], |
|
1018 ret = true, |
|
1019 fetchCSS = config.fetchCSS, |
|
1020 process = function(names, skip) { |
|
1021 |
|
1022 var i = 0, a = [], name, len, m, req, use; |
|
1023 |
|
1024 if (!names.length) { |
|
1025 return; |
|
1026 } |
|
1027 |
|
1028 if (aliases) { |
|
1029 len = names.length; |
|
1030 for (i = 0; i < len; i++) { |
|
1031 if (aliases[names[i]] && !mods[names[i]]) { |
|
1032 a = [].concat(a, aliases[names[i]]); |
|
1033 } else { |
|
1034 a.push(names[i]); |
|
1035 } |
|
1036 } |
|
1037 names = a; |
|
1038 } |
|
1039 |
|
1040 len = names.length; |
|
1041 |
|
1042 for (i = 0; i < len; i++) { |
|
1043 name = names[i]; |
|
1044 if (!skip) { |
|
1045 r.push(name); |
|
1046 } |
|
1047 |
|
1048 // only attach a module once |
|
1049 if (used[name]) { |
|
1050 continue; |
|
1051 } |
|
1052 |
|
1053 m = mods[name]; |
|
1054 req = null; |
|
1055 use = null; |
|
1056 |
|
1057 if (m) { |
|
1058 used[name] = true; |
|
1059 req = m.details.requires; |
|
1060 use = m.details.use; |
|
1061 } else { |
|
1062 // CSS files don't register themselves, see if it has |
|
1063 // been loaded |
|
1064 if (!G_ENV._loaded[VERSION][name]) { |
|
1065 missing.push(name); |
|
1066 } else { |
|
1067 used[name] = true; // probably css |
|
1068 } |
|
1069 } |
|
1070 |
|
1071 // make sure requirements are attached |
|
1072 if (req && req.length) { |
|
1073 process(req); |
|
1074 } |
|
1075 |
|
1076 // make sure we grab the submodule dependencies too |
|
1077 if (use && use.length) { |
|
1078 process(use, 1); |
|
1079 } |
|
1080 } |
|
1081 |
|
1082 }, |
|
1083 |
|
1084 handleLoader = function(fromLoader) { |
|
1085 var response = fromLoader || { |
|
1086 success: true, |
|
1087 msg: 'not dynamic' |
|
1088 }, |
|
1089 redo, origMissing, |
|
1090 ret = true, |
|
1091 data = response.data; |
|
1092 |
|
1093 Y._loading = false; |
|
1094 |
|
1095 if (data) { |
|
1096 origMissing = missing; |
|
1097 missing = []; |
|
1098 r = []; |
|
1099 process(data); |
|
1100 redo = missing.length; |
|
1101 if (redo) { |
|
1102 if ([].concat(missing).sort().join() == |
|
1103 origMissing.sort().join()) { |
|
1104 redo = false; |
|
1105 } |
|
1106 } |
|
1107 } |
|
1108 |
|
1109 if (redo && data) { |
|
1110 Y._loading = true; |
|
1111 Y._use(missing, function() { |
|
1112 if (Y._attach(data)) { |
|
1113 Y._notify(callback, response, data); |
|
1114 } |
|
1115 }); |
|
1116 } else { |
|
1117 if (data) { |
|
1118 ret = Y._attach(data); |
|
1119 } |
|
1120 if (ret) { |
|
1121 Y._notify(callback, response, args); |
|
1122 } |
|
1123 } |
|
1124 |
|
1125 if (Y._useQueue && Y._useQueue.size() && !Y._loading) { |
|
1126 Y._use.apply(Y, Y._useQueue.next()); |
|
1127 } |
|
1128 |
|
1129 }; |
|
1130 |
|
1131 |
|
1132 // YUI().use('*'); // bind everything available |
|
1133 if (firstArg === '*') { |
|
1134 args = []; |
|
1135 for (i in mods) { |
|
1136 if (mods.hasOwnProperty(i)) { |
|
1137 args.push(i); |
|
1138 } |
|
1139 } |
|
1140 ret = Y._attach(args); |
|
1141 if (ret) { |
|
1142 handleLoader(); |
|
1143 } |
|
1144 return Y; |
|
1145 } |
|
1146 |
|
1147 if ((mods.loader || mods['loader-base']) && !Y.Loader) { |
|
1148 Y._attach(['loader' + ((!mods.loader) ? '-base' : '')]); |
|
1149 } |
|
1150 |
|
1151 |
|
1152 // use loader to expand dependencies and sort the |
|
1153 // requirements if it is available. |
|
1154 if (boot && Y.Loader && args.length) { |
|
1155 loader = getLoader(Y); |
|
1156 loader.require(args); |
|
1157 loader.ignoreRegistered = true; |
|
1158 loader._boot = true; |
|
1159 loader.calculate(null, (fetchCSS) ? null : 'js'); |
|
1160 args = loader.sorted; |
|
1161 loader._boot = false; |
|
1162 } |
|
1163 |
|
1164 process(args); |
|
1165 |
|
1166 len = missing.length; |
|
1167 |
|
1168 |
|
1169 if (len) { |
|
1170 missing = YArray.dedupe(missing); |
|
1171 len = missing.length; |
|
1172 } |
|
1173 |
|
1174 |
|
1175 // dynamic load |
|
1176 if (boot && len && Y.Loader) { |
|
1177 Y._loading = true; |
|
1178 loader = getLoader(Y); |
|
1179 loader.onEnd = handleLoader; |
|
1180 loader.context = Y; |
|
1181 loader.data = args; |
|
1182 loader.ignoreRegistered = false; |
|
1183 loader.require(missing); |
|
1184 loader.insert(null, (fetchCSS) ? null : 'js'); |
|
1185 |
|
1186 } else if (boot && len && Y.Get && !Env.bootstrapped) { |
|
1187 |
|
1188 Y._loading = true; |
|
1189 |
|
1190 handleBoot = function() { |
|
1191 Y._loading = false; |
|
1192 queue.running = false; |
|
1193 Env.bootstrapped = true; |
|
1194 G_ENV._bootstrapping = false; |
|
1195 if (Y._attach(['loader'])) { |
|
1196 Y._use(args, callback); |
|
1197 } |
|
1198 }; |
|
1199 |
|
1200 if (G_ENV._bootstrapping) { |
|
1201 queue.add(handleBoot); |
|
1202 } else { |
|
1203 G_ENV._bootstrapping = true; |
|
1204 Y.Get.script(config.base + config.loaderPath, { |
|
1205 onEnd: handleBoot |
|
1206 }); |
|
1207 } |
|
1208 |
|
1209 } else { |
|
1210 ret = Y._attach(args); |
|
1211 if (ret) { |
|
1212 handleLoader(); |
|
1213 } |
|
1214 } |
|
1215 |
|
1216 return Y; |
|
1217 }, |
|
1218 |
|
1219 |
|
1220 /** |
|
1221 Utility method for safely creating namespaces if they don't already exist. |
|
1222 May be called statically on the YUI global object or as a method on a YUI |
|
1223 instance. |
|
1224 |
|
1225 When called statically, a namespace will be created on the YUI global |
|
1226 object: |
|
1227 |
|
1228 // Create `YUI.your.namespace.here` as nested objects, preserving any |
|
1229 // objects that already exist instead of overwriting them. |
|
1230 YUI.namespace('your.namespace.here'); |
|
1231 |
|
1232 When called as a method on a YUI instance, a namespace will be created on |
|
1233 that instance: |
|
1234 |
|
1235 // Creates `Y.property.package`. |
|
1236 Y.namespace('property.package'); |
|
1237 |
|
1238 Dots in the input string cause `namespace` to create nested objects for each |
|
1239 token. If any part of the requested namespace already exists, the current |
|
1240 object will be left in place and will not be overwritten. This allows |
|
1241 multiple calls to `namespace` to preserve existing namespaced properties. |
|
1242 |
|
1243 If the first token in the namespace string is "YAHOO", that token is |
|
1244 discarded. This is legacy behavior for backwards compatibility with YUI 2. |
|
1245 |
|
1246 Be careful with namespace tokens. Reserved words may work in some browsers |
|
1247 and not others. For instance, the following will fail in some browsers |
|
1248 because the supported version of JavaScript reserves the word "long": |
|
1249 |
|
1250 Y.namespace('really.long.nested.namespace'); |
|
1251 |
|
1252 Note: If you pass multiple arguments to create multiple namespaces, only the |
|
1253 last one created is returned from this function. |
|
1254 |
|
1255 @method namespace |
|
1256 @param {String} namespace* One or more namespaces to create. |
|
1257 @return {Object} Reference to the last namespace object created. |
|
1258 **/ |
|
1259 namespace: function() { |
|
1260 var a = arguments, o, i = 0, j, d, arg; |
|
1261 |
|
1262 for (; i < a.length; i++) { |
|
1263 o = this; //Reset base object per argument or it will get reused from the last |
|
1264 arg = a[i]; |
|
1265 if (arg.indexOf(PERIOD) > -1) { //Skip this if no "." is present |
|
1266 d = arg.split(PERIOD); |
|
1267 for (j = (d[0] == 'YAHOO') ? 1 : 0; j < d.length; j++) { |
|
1268 o[d[j]] = o[d[j]] || {}; |
|
1269 o = o[d[j]]; |
|
1270 } |
|
1271 } else { |
|
1272 o[arg] = o[arg] || {}; |
|
1273 o = o[arg]; //Reset base object to the new object so it's returned |
|
1274 } |
|
1275 } |
|
1276 return o; |
|
1277 }, |
|
1278 |
|
1279 // this is replaced if the log module is included |
|
1280 log: NOOP, |
|
1281 message: NOOP, |
|
1282 // this is replaced if the dump module is included |
|
1283 dump: function (o) { return ''+o; }, |
|
1284 |
|
1285 /** |
|
1286 Reports an error. |
|
1287 |
|
1288 The reporting mechanism is controlled by the `throwFail` configuration |
|
1289 attribute. If `throwFail` is falsy, the message is logged. If `throwFail` is |
|
1290 truthy, a JS exception is thrown. |
|
1291 |
|
1292 If an `errorFn` is specified in the config it must return `true` to indicate |
|
1293 that the exception was handled and keep it from being thrown. |
|
1294 |
|
1295 @method error |
|
1296 @param {String} msg Error message. |
|
1297 @param {Error|String} [e] JavaScript error object or an error string. |
|
1298 @param {String} [src] Source of the error (such as the name of the module in |
|
1299 which the error occurred). |
|
1300 @chainable |
|
1301 **/ |
|
1302 error: function(msg, e, src) { |
|
1303 //TODO Add check for window.onerror here |
|
1304 |
|
1305 var Y = this, ret; |
|
1306 |
|
1307 if (Y.config.errorFn) { |
|
1308 ret = Y.config.errorFn.apply(Y, arguments); |
|
1309 } |
|
1310 |
|
1311 if (!ret) { |
|
1312 throw (e || new Error(msg)); |
|
1313 } else { |
|
1314 Y.message(msg, 'error', ''+src); // don't scrub this one |
|
1315 } |
|
1316 |
|
1317 return Y; |
|
1318 }, |
|
1319 |
|
1320 /** |
|
1321 Generates an id string that is unique among all YUI instances in this |
|
1322 execution context. |
|
1323 |
|
1324 @method guid |
|
1325 @param {String} [pre] Prefix. |
|
1326 @return {String} Unique id. |
|
1327 **/ |
|
1328 guid: function(pre) { |
|
1329 var id = this.Env._guidp + '_' + (++this.Env._uidx); |
|
1330 return (pre) ? (pre + id) : id; |
|
1331 }, |
|
1332 |
|
1333 /** |
|
1334 Returns a unique id associated with the given object and (if *readOnly* is |
|
1335 falsy) stamps the object with that id so it can be identified in the future. |
|
1336 |
|
1337 Stamping an object involves adding a `_yuid` property to it that contains |
|
1338 the object's id. One exception to this is that in Internet Explorer, DOM |
|
1339 nodes have a `uniqueID` property that contains a browser-generated unique |
|
1340 id, which will be used instead of a YUI-generated id when available. |
|
1341 |
|
1342 @method stamp |
|
1343 @param {Object} o Object to stamp. |
|
1344 @param {Boolean} readOnly If truthy and the given object has not already |
|
1345 been stamped, the object will not be modified and `null` will be |
|
1346 returned. |
|
1347 @return {String} Object's unique id, or `null` if *readOnly* was truthy and |
|
1348 the given object was not already stamped. |
|
1349 **/ |
|
1350 stamp: function(o, readOnly) { |
|
1351 var uid; |
|
1352 if (!o) { |
|
1353 return o; |
|
1354 } |
|
1355 |
|
1356 // IE generates its own unique ID for dom nodes |
|
1357 // The uniqueID property of a document node returns a new ID |
|
1358 if (o.uniqueID && o.nodeType && o.nodeType !== 9) { |
|
1359 uid = o.uniqueID; |
|
1360 } else { |
|
1361 uid = (typeof o === 'string') ? o : o._yuid; |
|
1362 } |
|
1363 |
|
1364 if (!uid) { |
|
1365 uid = this.guid(); |
|
1366 if (!readOnly) { |
|
1367 try { |
|
1368 o._yuid = uid; |
|
1369 } catch (e) { |
|
1370 uid = null; |
|
1371 } |
|
1372 } |
|
1373 } |
|
1374 return uid; |
|
1375 }, |
|
1376 |
|
1377 /** |
|
1378 Destroys this YUI instance. |
|
1379 |
|
1380 @method destroy |
|
1381 @since 3.3.0 |
|
1382 **/ |
|
1383 destroy: function() { |
|
1384 var Y = this; |
|
1385 if (Y.Event) { |
|
1386 Y.Event._unload(); |
|
1387 } |
|
1388 delete instances[Y.id]; |
|
1389 delete Y.Env; |
|
1390 delete Y.config; |
|
1391 } |
|
1392 |
|
1393 /** |
|
1394 Safe `instanceof` wrapper that works around a memory leak in IE when the |
|
1395 object being tested is `window` or `document`. |
|
1396 |
|
1397 Unless you are testing objects that may be `window` or `document`, you |
|
1398 should use the native `instanceof` operator instead of this method. |
|
1399 |
|
1400 @method instanceOf |
|
1401 @param {Object} o Object to check. |
|
1402 @param {Object} type Class to check against. |
|
1403 @since 3.3.0 |
|
1404 **/ |
|
1405 }; |
|
1406 |
|
1407 YUI.prototype = proto; |
|
1408 |
|
1409 // inheritance utilities are not available yet |
|
1410 for (prop in proto) { |
|
1411 if (proto.hasOwnProperty(prop)) { |
|
1412 YUI[prop] = proto[prop]; |
|
1413 } |
|
1414 } |
|
1415 |
|
1416 /** |
|
1417 Applies a configuration to all YUI instances in this execution context. |
|
1418 |
|
1419 The main use case for this method is in "mashups" where several third-party |
|
1420 scripts need to write to a global YUI config, but cannot share a single |
|
1421 centrally-managed config object. This way they can all call |
|
1422 `YUI.applyConfig({})` instead of overwriting the single global config. |
|
1423 |
|
1424 @example |
|
1425 |
|
1426 YUI.applyConfig({ |
|
1427 modules: { |
|
1428 davglass: { |
|
1429 fullpath: './davglass.js' |
|
1430 } |
|
1431 } |
|
1432 }); |
|
1433 |
|
1434 YUI.applyConfig({ |
|
1435 modules: { |
|
1436 foo: { |
|
1437 fullpath: './foo.js' |
|
1438 } |
|
1439 } |
|
1440 }); |
|
1441 |
|
1442 YUI().use('davglass', function (Y) { |
|
1443 // Module davglass will be available here. |
|
1444 }); |
|
1445 |
|
1446 @method applyConfig |
|
1447 @param {Object} o Configuration object to apply. |
|
1448 @static |
|
1449 @since 3.5.0 |
|
1450 **/ |
|
1451 YUI.applyConfig = function(o) { |
|
1452 if (!o) { |
|
1453 return; |
|
1454 } |
|
1455 //If there is a GlobalConfig, apply it first to set the defaults |
|
1456 if (YUI.GlobalConfig) { |
|
1457 this.prototype.applyConfig.call(this, YUI.GlobalConfig); |
|
1458 } |
|
1459 //Apply this config to it |
|
1460 this.prototype.applyConfig.call(this, o); |
|
1461 //Reset GlobalConfig to the combined config |
|
1462 YUI.GlobalConfig = this.config; |
|
1463 }; |
|
1464 |
|
1465 // set up the environment |
|
1466 YUI._init(); |
|
1467 |
|
1468 if (hasWin) { |
|
1469 // add a window load event at load time so we can capture |
|
1470 // the case where it fires before dynamic loading is |
|
1471 // complete. |
|
1472 add(window, 'load', handleLoad); |
|
1473 } else { |
|
1474 handleLoad(); |
|
1475 } |
|
1476 |
|
1477 YUI.Env.add = add; |
|
1478 YUI.Env.remove = remove; |
|
1479 |
|
1480 /*global exports*/ |
|
1481 // Support the CommonJS method for exporting our single global |
|
1482 if (typeof exports == 'object') { |
|
1483 exports.YUI = YUI; |
|
1484 /** |
|
1485 * Set a method to be called when `Get.script` is called in Node.js |
|
1486 * `Get` will open the file, then pass it's content and it's path |
|
1487 * to this method before attaching it. Commonly used for code coverage |
|
1488 * instrumentation. <strong>Calling this multiple times will only |
|
1489 * attach the last hook method</strong>. This method is only |
|
1490 * available in Node.js. |
|
1491 * @method setLoadHook |
|
1492 * @static |
|
1493 * @param {Function} fn The function to set |
|
1494 * @param {String} fn.data The content of the file |
|
1495 * @param {String} fn.path The file path of the file |
|
1496 */ |
|
1497 YUI.setLoadHook = function(fn) { |
|
1498 YUI._getLoadHook = fn; |
|
1499 }; |
|
1500 /** |
|
1501 * Load hook for `Y.Get.script` in Node.js, see `YUI.setLoadHook` |
|
1502 * @method _getLoadHook |
|
1503 * @private |
|
1504 * @param {String} data The content of the file |
|
1505 * @param {String} path The file path of the file |
|
1506 */ |
|
1507 YUI._getLoadHook = null; |
|
1508 } |
|
1509 |
|
1510 }()); |
|
1511 |
|
1512 |
|
1513 /** |
|
1514 Config object that contains all of the configuration options for |
|
1515 this `YUI` instance. |
|
1516 |
|
1517 This object is supplied by the implementer when instantiating YUI. Some |
|
1518 properties have default values if they are not supplied by the implementer. |
|
1519 |
|
1520 This object should not be updated directly because some values are cached. Use |
|
1521 `applyConfig()` to update the config object on a YUI instance that has already |
|
1522 been configured. |
|
1523 |
|
1524 @class config |
|
1525 @static |
|
1526 **/ |
|
1527 |
|
1528 /** |
|
1529 If `true` (the default), YUI will "bootstrap" the YUI Loader and module metadata |
|
1530 if they're needed to load additional dependencies and aren't already available. |
|
1531 |
|
1532 Setting this to `false` will prevent YUI from automatically loading the Loader |
|
1533 and module metadata, so you will need to manually ensure that they're available |
|
1534 or handle dependency resolution yourself. |
|
1535 |
|
1536 @property {Boolean} bootstrap |
|
1537 @default true |
|
1538 **/ |
|
1539 |
|
1540 /** |
|
1541 |
|
1542 @property {Object} aliases |
|
1543 **/ |
|
1544 |
|
1545 /** |
|
1546 A hash of module group definitions. |
|
1547 |
|
1548 For each group you can specify a list of modules and the base path and |
|
1549 combo spec to use when dynamically loading the modules. |
|
1550 |
|
1551 @example |
|
1552 |
|
1553 groups: { |
|
1554 yui2: { |
|
1555 // specify whether or not this group has a combo service |
|
1556 combine: true, |
|
1557 |
|
1558 // The comboSeperator to use with this group's combo handler |
|
1559 comboSep: ';', |
|
1560 |
|
1561 // The maxURLLength for this server |
|
1562 maxURLLength: 500, |
|
1563 |
|
1564 // the base path for non-combo paths |
|
1565 base: 'http://yui.yahooapis.com/2.8.0r4/build/', |
|
1566 |
|
1567 // the path to the combo service |
|
1568 comboBase: 'http://yui.yahooapis.com/combo?', |
|
1569 |
|
1570 // a fragment to prepend to the path attribute when |
|
1571 // when building combo urls |
|
1572 root: '2.8.0r4/build/', |
|
1573 |
|
1574 // the module definitions |
|
1575 modules: { |
|
1576 yui2_yde: { |
|
1577 path: "yahoo-dom-event/yahoo-dom-event.js" |
|
1578 }, |
|
1579 yui2_anim: { |
|
1580 path: "animation/animation.js", |
|
1581 requires: ['yui2_yde'] |
|
1582 } |
|
1583 } |
|
1584 } |
|
1585 } |
|
1586 |
|
1587 @property {Object} groups |
|
1588 **/ |
|
1589 |
|
1590 /** |
|
1591 Path to the Loader JS file, relative to the `base` path. |
|
1592 |
|
1593 This is used to dynamically bootstrap the Loader when it's needed and isn't yet |
|
1594 available. |
|
1595 |
|
1596 @property {String} loaderPath |
|
1597 @default "loader/loader-min.js" |
|
1598 **/ |
|
1599 |
|
1600 /** |
|
1601 If `true`, YUI will attempt to load CSS dependencies and skins. Set this to |
|
1602 `false` to prevent YUI from loading any CSS, or set it to the string `"force"` |
|
1603 to force CSS dependencies to be loaded even if their associated JS modules are |
|
1604 already loaded. |
|
1605 |
|
1606 @property {Boolean|String} fetchCSS |
|
1607 @default true |
|
1608 **/ |
|
1609 |
|
1610 /** |
|
1611 Default gallery version used to build gallery module urls. |
|
1612 |
|
1613 @property {String} gallery |
|
1614 @since 3.1.0 |
|
1615 **/ |
|
1616 |
|
1617 /** |
|
1618 Default YUI 2 version used to build YUI 2 module urls. |
|
1619 |
|
1620 This is used for intrinsic YUI 2 support via the 2in3 project. Also see the |
|
1621 `2in3` config for pulling different revisions of the wrapped YUI 2 modules. |
|
1622 |
|
1623 @property {String} yui2 |
|
1624 @default "2.9.0" |
|
1625 @since 3.1.0 |
|
1626 **/ |
|
1627 |
|
1628 /** |
|
1629 Revision number of YUI 2in3 modules that should be used when loading YUI 2in3. |
|
1630 |
|
1631 @property {String} 2in3 |
|
1632 @default "4" |
|
1633 @since 3.1.0 |
|
1634 **/ |
|
1635 |
|
1636 /** |
|
1637 Alternate console log function that should be used in environments without a |
|
1638 supported native console. This function is executed with the YUI instance as its |
|
1639 `this` object. |
|
1640 |
|
1641 @property {Function} logFn |
|
1642 @since 3.1.0 |
|
1643 **/ |
|
1644 |
|
1645 /** |
|
1646 The minimum log level to log messages for. Log levels are defined |
|
1647 incrementally. Messages greater than or equal to the level specified will |
|
1648 be shown. All others will be discarded. The order of log levels in |
|
1649 increasing priority is: |
|
1650 |
|
1651 debug |
|
1652 info |
|
1653 warn |
|
1654 error |
|
1655 |
|
1656 @property {String} logLevel |
|
1657 @default 'debug' |
|
1658 @since 3.10.0 |
|
1659 **/ |
|
1660 |
|
1661 /** |
|
1662 Callback to execute when `Y.error()` is called. It receives the error message |
|
1663 and a JavaScript error object if one was provided. |
|
1664 |
|
1665 This function is executed with the YUI instance as its `this` object. |
|
1666 |
|
1667 Returning `true` from this function will prevent an exception from being thrown. |
|
1668 |
|
1669 @property {Function} errorFn |
|
1670 @param {String} errorFn.msg Error message |
|
1671 @param {Object} [errorFn.err] Error object (if one was provided). |
|
1672 @since 3.2.0 |
|
1673 **/ |
|
1674 |
|
1675 /** |
|
1676 A callback to execute when Loader fails to load one or more resources. |
|
1677 |
|
1678 This could be because of a script load failure. It could also be because a |
|
1679 module fails to register itself when the `requireRegistration` config is `true`. |
|
1680 |
|
1681 If this function is defined, the `use()` callback will only be called when the |
|
1682 loader succeeds. Otherwise, `use()` will always executes unless there was a |
|
1683 JavaScript error when attaching a module. |
|
1684 |
|
1685 @property {Function} loadErrorFn |
|
1686 @since 3.3.0 |
|
1687 **/ |
|
1688 |
|
1689 /** |
|
1690 If `true`, Loader will expect all loaded scripts to be first-class YUI modules |
|
1691 that register themselves with the YUI global, and will trigger a failure if a |
|
1692 loaded script does not register a YUI module. |
|
1693 |
|
1694 @property {Boolean} requireRegistration |
|
1695 @default false |
|
1696 @since 3.3.0 |
|
1697 **/ |
|
1698 |
|
1699 /** |
|
1700 Cache serviced use() requests. |
|
1701 |
|
1702 @property {Boolean} cacheUse |
|
1703 @default true |
|
1704 @since 3.3.0 |
|
1705 @deprecated No longer used. |
|
1706 **/ |
|
1707 |
|
1708 /** |
|
1709 Whether or not YUI should use native ES5 functionality when available for |
|
1710 features like `Y.Array.each()`, `Y.Object()`, etc. |
|
1711 |
|
1712 When `false`, YUI will always use its own fallback implementations instead of |
|
1713 relying on ES5 functionality, even when ES5 functionality is available. |
|
1714 |
|
1715 @property {Boolean} useNativeES5 |
|
1716 @default true |
|
1717 @since 3.5.0 |
|
1718 **/ |
|
1719 |
|
1720 /** |
|
1721 * Leverage native JSON stringify if the browser has a native |
|
1722 * implementation. In general, this is a good idea. See the Known Issues |
|
1723 * section in the JSON user guide for caveats. The default value is true |
|
1724 * for browsers with native JSON support. |
|
1725 * |
|
1726 * @property useNativeJSONStringify |
|
1727 * @type Boolean |
|
1728 * @default true |
|
1729 * @since 3.8.0 |
|
1730 */ |
|
1731 |
|
1732 /** |
|
1733 * Leverage native JSON parse if the browser has a native implementation. |
|
1734 * In general, this is a good idea. See the Known Issues section in the |
|
1735 * JSON user guide for caveats. The default value is true for browsers with |
|
1736 * native JSON support. |
|
1737 * |
|
1738 * @property useNativeJSONParse |
|
1739 * @type Boolean |
|
1740 * @default true |
|
1741 * @since 3.8.0 |
|
1742 */ |
|
1743 |
|
1744 /** |
|
1745 Delay the `use` callback until a specific event has passed (`load`, `domready`, `contentready` or `available`) |
|
1746 |
|
1747 @property {Object|String} delayUntil |
|
1748 @since 3.6.0 |
|
1749 @example |
|
1750 |
|
1751 You can use `load` or `domready` strings by default: |
|
1752 |
|
1753 YUI({ |
|
1754 delayUntil: 'domready' |
|
1755 }, function (Y) { |
|
1756 // This will not execute until 'domeready' occurs. |
|
1757 }); |
|
1758 |
|
1759 Or you can delay until a node is available (with `available` or `contentready`): |
|
1760 |
|
1761 YUI({ |
|
1762 delayUntil: { |
|
1763 event: 'available', |
|
1764 args : '#foo' |
|
1765 } |
|
1766 }, function (Y) { |
|
1767 // This will not execute until a node matching the selector "#foo" is |
|
1768 // available in the DOM. |
|
1769 }); |
|
1770 |
|
1771 **/ |
|
1772 YUI.add('yui-base', function (Y, NAME) { |
|
1773 |
|
1774 /* |
|
1775 * YUI stub |
|
1776 * @module yui |
|
1777 * @submodule yui-base |
|
1778 */ |
|
1779 /** |
|
1780 * The YUI module contains the components required for building the YUI |
|
1781 * seed file. This includes the script loading mechanism, a simple queue, |
|
1782 * and the core utilities for the library. |
|
1783 * @module yui |
|
1784 * @submodule yui-base |
|
1785 */ |
|
1786 |
|
1787 /** |
|
1788 * Provides core language utilites and extensions used throughout YUI. |
|
1789 * |
|
1790 * @class Lang |
|
1791 * @static |
|
1792 */ |
|
1793 |
|
1794 var L = Y.Lang || (Y.Lang = {}), |
|
1795 |
|
1796 STRING_PROTO = String.prototype, |
|
1797 TOSTRING = Object.prototype.toString, |
|
1798 |
|
1799 TYPES = { |
|
1800 'undefined' : 'undefined', |
|
1801 'number' : 'number', |
|
1802 'boolean' : 'boolean', |
|
1803 'string' : 'string', |
|
1804 '[object Function]': 'function', |
|
1805 '[object RegExp]' : 'regexp', |
|
1806 '[object Array]' : 'array', |
|
1807 '[object Date]' : 'date', |
|
1808 '[object Error]' : 'error' |
|
1809 }, |
|
1810 |
|
1811 SUBREGEX = /\{\s*([^|}]+?)\s*(?:\|([^}]*))?\s*\}/g, |
|
1812 TRIMREGEX = /^\s+|\s+$/g, |
|
1813 NATIVE_FN_REGEX = /\{\s*\[(?:native code|function)\]\s*\}/i; |
|
1814 |
|
1815 // -- Protected Methods -------------------------------------------------------- |
|
1816 |
|
1817 /** |
|
1818 Returns `true` if the given function appears to be implemented in native code, |
|
1819 `false` otherwise. Will always return `false` -- even in ES5-capable browsers -- |
|
1820 if the `useNativeES5` YUI config option is set to `false`. |
|
1821 |
|
1822 This isn't guaranteed to be 100% accurate and won't work for anything other than |
|
1823 functions, but it can be useful for determining whether a function like |
|
1824 `Array.prototype.forEach` is native or a JS shim provided by another library. |
|
1825 |
|
1826 There's a great article by @kangax discussing certain flaws with this technique: |
|
1827 <http://perfectionkills.com/detecting-built-in-host-methods/> |
|
1828 |
|
1829 While his points are valid, it's still possible to benefit from this function |
|
1830 as long as it's used carefully and sparingly, and in such a way that false |
|
1831 negatives have minimal consequences. It's used internally to avoid using |
|
1832 potentially broken non-native ES5 shims that have been added to the page by |
|
1833 other libraries. |
|
1834 |
|
1835 @method _isNative |
|
1836 @param {Function} fn Function to test. |
|
1837 @return {Boolean} `true` if _fn_ appears to be native, `false` otherwise. |
|
1838 @static |
|
1839 @protected |
|
1840 @since 3.5.0 |
|
1841 **/ |
|
1842 L._isNative = function (fn) { |
|
1843 return !!(Y.config.useNativeES5 && fn && NATIVE_FN_REGEX.test(fn)); |
|
1844 }; |
|
1845 |
|
1846 // -- Public Methods ----------------------------------------------------------- |
|
1847 |
|
1848 /** |
|
1849 * Determines whether or not the provided item is an array. |
|
1850 * |
|
1851 * Returns `false` for array-like collections such as the function `arguments` |
|
1852 * collection or `HTMLElement` collections. Use `Y.Array.test()` if you want to |
|
1853 * test for an array-like collection. |
|
1854 * |
|
1855 * @method isArray |
|
1856 * @param o The object to test. |
|
1857 * @return {boolean} true if o is an array. |
|
1858 * @static |
|
1859 */ |
|
1860 L.isArray = L._isNative(Array.isArray) ? Array.isArray : function (o) { |
|
1861 return L.type(o) === 'array'; |
|
1862 }; |
|
1863 |
|
1864 /** |
|
1865 * Determines whether or not the provided item is a boolean. |
|
1866 * @method isBoolean |
|
1867 * @static |
|
1868 * @param o The object to test. |
|
1869 * @return {boolean} true if o is a boolean. |
|
1870 */ |
|
1871 L.isBoolean = function(o) { |
|
1872 return typeof o === 'boolean'; |
|
1873 }; |
|
1874 |
|
1875 /** |
|
1876 * Determines whether or not the supplied item is a date instance. |
|
1877 * @method isDate |
|
1878 * @static |
|
1879 * @param o The object to test. |
|
1880 * @return {boolean} true if o is a date. |
|
1881 */ |
|
1882 L.isDate = function(o) { |
|
1883 return L.type(o) === 'date' && o.toString() !== 'Invalid Date' && !isNaN(o); |
|
1884 }; |
|
1885 |
|
1886 /** |
|
1887 * <p> |
|
1888 * Determines whether or not the provided item is a function. |
|
1889 * Note: Internet Explorer thinks certain functions are objects: |
|
1890 * </p> |
|
1891 * |
|
1892 * <pre> |
|
1893 * var obj = document.createElement("object"); |
|
1894 * Y.Lang.isFunction(obj.getAttribute) // reports false in IE |
|
1895 * |
|
1896 * var input = document.createElement("input"); // append to body |
|
1897 * Y.Lang.isFunction(input.focus) // reports false in IE |
|
1898 * </pre> |
|
1899 * |
|
1900 * <p> |
|
1901 * You will have to implement additional tests if these functions |
|
1902 * matter to you. |
|
1903 * </p> |
|
1904 * |
|
1905 * @method isFunction |
|
1906 * @static |
|
1907 * @param o The object to test. |
|
1908 * @return {boolean} true if o is a function. |
|
1909 */ |
|
1910 L.isFunction = function(o) { |
|
1911 return L.type(o) === 'function'; |
|
1912 }; |
|
1913 |
|
1914 /** |
|
1915 * Determines whether or not the provided item is null. |
|
1916 * @method isNull |
|
1917 * @static |
|
1918 * @param o The object to test. |
|
1919 * @return {boolean} true if o is null. |
|
1920 */ |
|
1921 L.isNull = function(o) { |
|
1922 return o === null; |
|
1923 }; |
|
1924 |
|
1925 /** |
|
1926 * Determines whether or not the provided item is a legal number. |
|
1927 * @method isNumber |
|
1928 * @static |
|
1929 * @param o The object to test. |
|
1930 * @return {boolean} true if o is a number. |
|
1931 */ |
|
1932 L.isNumber = function(o) { |
|
1933 return typeof o === 'number' && isFinite(o); |
|
1934 }; |
|
1935 |
|
1936 /** |
|
1937 * Determines whether or not the provided item is of type object |
|
1938 * or function. Note that arrays are also objects, so |
|
1939 * <code>Y.Lang.isObject([]) === true</code>. |
|
1940 * @method isObject |
|
1941 * @static |
|
1942 * @param o The object to test. |
|
1943 * @param failfn {boolean} fail if the input is a function. |
|
1944 * @return {boolean} true if o is an object. |
|
1945 * @see isPlainObject |
|
1946 */ |
|
1947 L.isObject = function(o, failfn) { |
|
1948 var t = typeof o; |
|
1949 return (o && (t === 'object' || |
|
1950 (!failfn && (t === 'function' || L.isFunction(o))))) || false; |
|
1951 }; |
|
1952 |
|
1953 /** |
|
1954 * Determines whether or not the provided item is a string. |
|
1955 * @method isString |
|
1956 * @static |
|
1957 * @param o The object to test. |
|
1958 * @return {boolean} true if o is a string. |
|
1959 */ |
|
1960 L.isString = function(o) { |
|
1961 return typeof o === 'string'; |
|
1962 }; |
|
1963 |
|
1964 /** |
|
1965 * Determines whether or not the provided item is undefined. |
|
1966 * @method isUndefined |
|
1967 * @static |
|
1968 * @param o The object to test. |
|
1969 * @return {boolean} true if o is undefined. |
|
1970 */ |
|
1971 L.isUndefined = function(o) { |
|
1972 return typeof o === 'undefined'; |
|
1973 }; |
|
1974 |
|
1975 /** |
|
1976 * A convenience method for detecting a legitimate non-null value. |
|
1977 * Returns false for null/undefined/NaN, true for other values, |
|
1978 * including 0/false/'' |
|
1979 * @method isValue |
|
1980 * @static |
|
1981 * @param o The item to test. |
|
1982 * @return {boolean} true if it is not null/undefined/NaN || false. |
|
1983 */ |
|
1984 L.isValue = function(o) { |
|
1985 var t = L.type(o); |
|
1986 |
|
1987 switch (t) { |
|
1988 case 'number': |
|
1989 return isFinite(o); |
|
1990 |
|
1991 case 'null': // fallthru |
|
1992 case 'undefined': |
|
1993 return false; |
|
1994 |
|
1995 default: |
|
1996 return !!t; |
|
1997 } |
|
1998 }; |
|
1999 |
|
2000 /** |
|
2001 * Returns the current time in milliseconds. |
|
2002 * |
|
2003 * @method now |
|
2004 * @return {Number} Current time in milliseconds. |
|
2005 * @static |
|
2006 * @since 3.3.0 |
|
2007 */ |
|
2008 L.now = Date.now || function () { |
|
2009 return new Date().getTime(); |
|
2010 }; |
|
2011 |
|
2012 /** |
|
2013 * Lightweight version of <code>Y.substitute</code>. Uses the same template |
|
2014 * structure as <code>Y.substitute</code>, but doesn't support recursion, |
|
2015 * auto-object coersion, or formats. |
|
2016 * @method sub |
|
2017 * @param {string} s String to be modified. |
|
2018 * @param {object} o Object containing replacement values. |
|
2019 * @return {string} the substitute result. |
|
2020 * @static |
|
2021 * @since 3.2.0 |
|
2022 */ |
|
2023 L.sub = function(s, o) { |
|
2024 return s.replace ? s.replace(SUBREGEX, function (match, key) { |
|
2025 return L.isUndefined(o[key]) ? match : o[key]; |
|
2026 }) : s; |
|
2027 }; |
|
2028 |
|
2029 /** |
|
2030 * Returns a string without any leading or trailing whitespace. If |
|
2031 * the input is not a string, the input will be returned untouched. |
|
2032 * @method trim |
|
2033 * @static |
|
2034 * @param s {string} the string to trim. |
|
2035 * @return {string} the trimmed string. |
|
2036 */ |
|
2037 L.trim = STRING_PROTO.trim ? function(s) { |
|
2038 return s && s.trim ? s.trim() : s; |
|
2039 } : function (s) { |
|
2040 try { |
|
2041 return s.replace(TRIMREGEX, ''); |
|
2042 } catch (e) { |
|
2043 return s; |
|
2044 } |
|
2045 }; |
|
2046 |
|
2047 /** |
|
2048 * Returns a string without any leading whitespace. |
|
2049 * @method trimLeft |
|
2050 * @static |
|
2051 * @param s {string} the string to trim. |
|
2052 * @return {string} the trimmed string. |
|
2053 */ |
|
2054 L.trimLeft = STRING_PROTO.trimLeft ? function (s) { |
|
2055 return s.trimLeft(); |
|
2056 } : function (s) { |
|
2057 return s.replace(/^\s+/, ''); |
|
2058 }; |
|
2059 |
|
2060 /** |
|
2061 * Returns a string without any trailing whitespace. |
|
2062 * @method trimRight |
|
2063 * @static |
|
2064 * @param s {string} the string to trim. |
|
2065 * @return {string} the trimmed string. |
|
2066 */ |
|
2067 L.trimRight = STRING_PROTO.trimRight ? function (s) { |
|
2068 return s.trimRight(); |
|
2069 } : function (s) { |
|
2070 return s.replace(/\s+$/, ''); |
|
2071 }; |
|
2072 |
|
2073 /** |
|
2074 Returns one of the following strings, representing the type of the item passed |
|
2075 in: |
|
2076 |
|
2077 * "array" |
|
2078 * "boolean" |
|
2079 * "date" |
|
2080 * "error" |
|
2081 * "function" |
|
2082 * "null" |
|
2083 * "number" |
|
2084 * "object" |
|
2085 * "regexp" |
|
2086 * "string" |
|
2087 * "undefined" |
|
2088 |
|
2089 Known issues: |
|
2090 |
|
2091 * `typeof HTMLElementCollection` returns function in Safari, but |
|
2092 `Y.Lang.type()` reports "object", which could be a good thing -- |
|
2093 but it actually caused the logic in <code>Y.Lang.isObject</code> to fail. |
|
2094 |
|
2095 @method type |
|
2096 @param o the item to test. |
|
2097 @return {string} the detected type. |
|
2098 @static |
|
2099 **/ |
|
2100 L.type = function(o) { |
|
2101 return TYPES[typeof o] || TYPES[TOSTRING.call(o)] || (o ? 'object' : 'null'); |
|
2102 }; |
|
2103 /** |
|
2104 @module yui |
|
2105 @submodule yui-base |
|
2106 */ |
|
2107 |
|
2108 var Lang = Y.Lang, |
|
2109 Native = Array.prototype, |
|
2110 |
|
2111 hasOwn = Object.prototype.hasOwnProperty; |
|
2112 |
|
2113 /** |
|
2114 Provides utility methods for working with arrays. Additional array helpers can |
|
2115 be found in the `collection` and `array-extras` modules. |
|
2116 |
|
2117 `Y.Array(thing)` returns a native array created from _thing_. Depending on |
|
2118 _thing_'s type, one of the following will happen: |
|
2119 |
|
2120 * Arrays are returned unmodified unless a non-zero _startIndex_ is |
|
2121 specified. |
|
2122 * Array-like collections (see `Array.test()`) are converted to arrays. |
|
2123 * For everything else, a new array is created with _thing_ as the sole |
|
2124 item. |
|
2125 |
|
2126 Note: elements that are also collections, such as `<form>` and `<select>` |
|
2127 elements, are not automatically converted to arrays. To force a conversion, |
|
2128 pass `true` as the value of the _force_ parameter. |
|
2129 |
|
2130 @class Array |
|
2131 @constructor |
|
2132 @param {Any} thing The thing to arrayify. |
|
2133 @param {Number} [startIndex=0] If non-zero and _thing_ is an array or array-like |
|
2134 collection, a subset of items starting at the specified index will be |
|
2135 returned. |
|
2136 @param {Boolean} [force=false] If `true`, _thing_ will be treated as an |
|
2137 array-like collection no matter what. |
|
2138 @return {Array} A native array created from _thing_, according to the rules |
|
2139 described above. |
|
2140 **/ |
|
2141 function YArray(thing, startIndex, force) { |
|
2142 var len, result; |
|
2143 |
|
2144 /*jshint expr: true*/ |
|
2145 startIndex || (startIndex = 0); |
|
2146 |
|
2147 if (force || YArray.test(thing)) { |
|
2148 // IE throws when trying to slice HTMLElement collections. |
|
2149 try { |
|
2150 return Native.slice.call(thing, startIndex); |
|
2151 } catch (ex) { |
|
2152 result = []; |
|
2153 |
|
2154 for (len = thing.length; startIndex < len; ++startIndex) { |
|
2155 result.push(thing[startIndex]); |
|
2156 } |
|
2157 |
|
2158 return result; |
|
2159 } |
|
2160 } |
|
2161 |
|
2162 return [thing]; |
|
2163 } |
|
2164 |
|
2165 Y.Array = YArray; |
|
2166 |
|
2167 /** |
|
2168 Dedupes an array of strings, returning an array that's guaranteed to contain |
|
2169 only one copy of a given string. |
|
2170 |
|
2171 This method differs from `Array.unique()` in that it's optimized for use only |
|
2172 with strings, whereas `unique` may be used with other types (but is slower). |
|
2173 Using `dedupe()` with non-string values may result in unexpected behavior. |
|
2174 |
|
2175 @method dedupe |
|
2176 @param {String[]} array Array of strings to dedupe. |
|
2177 @return {Array} Deduped copy of _array_. |
|
2178 @static |
|
2179 @since 3.4.0 |
|
2180 **/ |
|
2181 YArray.dedupe = function (array) { |
|
2182 var hash = {}, |
|
2183 results = [], |
|
2184 i, item, len; |
|
2185 |
|
2186 for (i = 0, len = array.length; i < len; ++i) { |
|
2187 item = array[i]; |
|
2188 |
|
2189 if (!hasOwn.call(hash, item)) { |
|
2190 hash[item] = 1; |
|
2191 results.push(item); |
|
2192 } |
|
2193 } |
|
2194 |
|
2195 return results; |
|
2196 }; |
|
2197 |
|
2198 /** |
|
2199 Executes the supplied function on each item in the array. This method wraps |
|
2200 the native ES5 `Array.forEach()` method if available. |
|
2201 |
|
2202 @method each |
|
2203 @param {Array} array Array to iterate. |
|
2204 @param {Function} fn Function to execute on each item in the array. The function |
|
2205 will receive the following arguments: |
|
2206 @param {Any} fn.item Current array item. |
|
2207 @param {Number} fn.index Current array index. |
|
2208 @param {Array} fn.array Array being iterated. |
|
2209 @param {Object} [thisObj] `this` object to use when calling _fn_. |
|
2210 @return {YUI} The YUI instance. |
|
2211 @static |
|
2212 **/ |
|
2213 YArray.each = YArray.forEach = Lang._isNative(Native.forEach) ? function (array, fn, thisObj) { |
|
2214 Native.forEach.call(array || [], fn, thisObj || Y); |
|
2215 return Y; |
|
2216 } : function (array, fn, thisObj) { |
|
2217 for (var i = 0, len = (array && array.length) || 0; i < len; ++i) { |
|
2218 if (i in array) { |
|
2219 fn.call(thisObj || Y, array[i], i, array); |
|
2220 } |
|
2221 } |
|
2222 |
|
2223 return Y; |
|
2224 }; |
|
2225 |
|
2226 /** |
|
2227 Alias for `each()`. |
|
2228 |
|
2229 @method forEach |
|
2230 @static |
|
2231 **/ |
|
2232 |
|
2233 /** |
|
2234 Returns an object using the first array as keys and the second as values. If |
|
2235 the second array is not provided, or if it doesn't contain the same number of |
|
2236 values as the first array, then `true` will be used in place of the missing |
|
2237 values. |
|
2238 |
|
2239 @example |
|
2240 |
|
2241 Y.Array.hash(['a', 'b', 'c'], ['foo', 'bar']); |
|
2242 // => {a: 'foo', b: 'bar', c: true} |
|
2243 |
|
2244 @method hash |
|
2245 @param {String[]} keys Array of strings to use as keys. |
|
2246 @param {Array} [values] Array to use as values. |
|
2247 @return {Object} Hash using the first array as keys and the second as values. |
|
2248 @static |
|
2249 **/ |
|
2250 YArray.hash = function (keys, values) { |
|
2251 var hash = {}, |
|
2252 vlen = (values && values.length) || 0, |
|
2253 i, len; |
|
2254 |
|
2255 for (i = 0, len = keys.length; i < len; ++i) { |
|
2256 if (i in keys) { |
|
2257 hash[keys[i]] = vlen > i && i in values ? values[i] : true; |
|
2258 } |
|
2259 } |
|
2260 |
|
2261 return hash; |
|
2262 }; |
|
2263 |
|
2264 /** |
|
2265 Returns the index of the first item in the array that's equal (using a strict |
|
2266 equality check) to the specified _value_, or `-1` if the value isn't found. |
|
2267 |
|
2268 This method wraps the native ES5 `Array.indexOf()` method if available. |
|
2269 |
|
2270 @method indexOf |
|
2271 @param {Array} array Array to search. |
|
2272 @param {Any} value Value to search for. |
|
2273 @param {Number} [from=0] The index at which to begin the search. |
|
2274 @return {Number} Index of the item strictly equal to _value_, or `-1` if not |
|
2275 found. |
|
2276 @static |
|
2277 **/ |
|
2278 YArray.indexOf = Lang._isNative(Native.indexOf) ? function (array, value, from) { |
|
2279 return Native.indexOf.call(array, value, from); |
|
2280 } : function (array, value, from) { |
|
2281 // http://es5.github.com/#x15.4.4.14 |
|
2282 var len = array.length; |
|
2283 |
|
2284 from = +from || 0; |
|
2285 from = (from > 0 || -1) * Math.floor(Math.abs(from)); |
|
2286 |
|
2287 if (from < 0) { |
|
2288 from += len; |
|
2289 |
|
2290 if (from < 0) { |
|
2291 from = 0; |
|
2292 } |
|
2293 } |
|
2294 |
|
2295 for (; from < len; ++from) { |
|
2296 if (from in array && array[from] === value) { |
|
2297 return from; |
|
2298 } |
|
2299 } |
|
2300 |
|
2301 return -1; |
|
2302 }; |
|
2303 |
|
2304 /** |
|
2305 Numeric sort convenience function. |
|
2306 |
|
2307 The native `Array.prototype.sort()` function converts values to strings and |
|
2308 sorts them in lexicographic order, which is unsuitable for sorting numeric |
|
2309 values. Provide `Array.numericSort` as a custom sort function when you want |
|
2310 to sort values in numeric order. |
|
2311 |
|
2312 @example |
|
2313 |
|
2314 [42, 23, 8, 16, 4, 15].sort(Y.Array.numericSort); |
|
2315 // => [4, 8, 15, 16, 23, 42] |
|
2316 |
|
2317 @method numericSort |
|
2318 @param {Number} a First value to compare. |
|
2319 @param {Number} b Second value to compare. |
|
2320 @return {Number} Difference between _a_ and _b_. |
|
2321 @static |
|
2322 **/ |
|
2323 YArray.numericSort = function (a, b) { |
|
2324 return a - b; |
|
2325 }; |
|
2326 |
|
2327 /** |
|
2328 Executes the supplied function on each item in the array. Returning a truthy |
|
2329 value from the function will stop the processing of remaining items. |
|
2330 |
|
2331 @method some |
|
2332 @param {Array} array Array to iterate over. |
|
2333 @param {Function} fn Function to execute on each item. The function will receive |
|
2334 the following arguments: |
|
2335 @param {Any} fn.value Current array item. |
|
2336 @param {Number} fn.index Current array index. |
|
2337 @param {Array} fn.array Array being iterated over. |
|
2338 @param {Object} [thisObj] `this` object to use when calling _fn_. |
|
2339 @return {Boolean} `true` if the function returns a truthy value on any of the |
|
2340 items in the array; `false` otherwise. |
|
2341 @static |
|
2342 **/ |
|
2343 YArray.some = Lang._isNative(Native.some) ? function (array, fn, thisObj) { |
|
2344 return Native.some.call(array, fn, thisObj); |
|
2345 } : function (array, fn, thisObj) { |
|
2346 for (var i = 0, len = array.length; i < len; ++i) { |
|
2347 if (i in array && fn.call(thisObj, array[i], i, array)) { |
|
2348 return true; |
|
2349 } |
|
2350 } |
|
2351 |
|
2352 return false; |
|
2353 }; |
|
2354 |
|
2355 /** |
|
2356 Evaluates _obj_ to determine if it's an array, an array-like collection, or |
|
2357 something else. This is useful when working with the function `arguments` |
|
2358 collection and `HTMLElement` collections. |
|
2359 |
|
2360 Note: This implementation doesn't consider elements that are also |
|
2361 collections, such as `<form>` and `<select>`, to be array-like. |
|
2362 |
|
2363 @method test |
|
2364 @param {Object} obj Object to test. |
|
2365 @return {Number} A number indicating the results of the test: |
|
2366 |
|
2367 * 0: Neither an array nor an array-like collection. |
|
2368 * 1: Real array. |
|
2369 * 2: Array-like collection. |
|
2370 |
|
2371 @static |
|
2372 **/ |
|
2373 YArray.test = function (obj) { |
|
2374 var result = 0; |
|
2375 |
|
2376 if (Lang.isArray(obj)) { |
|
2377 result = 1; |
|
2378 } else if (Lang.isObject(obj)) { |
|
2379 try { |
|
2380 // indexed, but no tagName (element) or scrollTo/document (window. From DOM.isWindow test which we can't use here), |
|
2381 // or functions without apply/call (Safari |
|
2382 // HTMLElementCollection bug). |
|
2383 if ('length' in obj && !obj.tagName && !(obj.scrollTo && obj.document) && !obj.apply) { |
|
2384 result = 2; |
|
2385 } |
|
2386 } catch (ex) {} |
|
2387 } |
|
2388 |
|
2389 return result; |
|
2390 }; |
|
2391 /** |
|
2392 * The YUI module contains the components required for building the YUI |
|
2393 * seed file. This includes the script loading mechanism, a simple queue, |
|
2394 * and the core utilities for the library. |
|
2395 * @module yui |
|
2396 * @submodule yui-base |
|
2397 */ |
|
2398 |
|
2399 /** |
|
2400 * A simple FIFO queue. Items are added to the Queue with add(1..n items) and |
|
2401 * removed using next(). |
|
2402 * |
|
2403 * @class Queue |
|
2404 * @constructor |
|
2405 * @param {MIXED} item* 0..n items to seed the queue. |
|
2406 */ |
|
2407 function Queue() { |
|
2408 this._init(); |
|
2409 this.add.apply(this, arguments); |
|
2410 } |
|
2411 |
|
2412 Queue.prototype = { |
|
2413 /** |
|
2414 * Initialize the queue |
|
2415 * |
|
2416 * @method _init |
|
2417 * @protected |
|
2418 */ |
|
2419 _init: function() { |
|
2420 /** |
|
2421 * The collection of enqueued items |
|
2422 * |
|
2423 * @property _q |
|
2424 * @type Array |
|
2425 * @protected |
|
2426 */ |
|
2427 this._q = []; |
|
2428 }, |
|
2429 |
|
2430 /** |
|
2431 * Get the next item in the queue. FIFO support |
|
2432 * |
|
2433 * @method next |
|
2434 * @return {MIXED} the next item in the queue. |
|
2435 */ |
|
2436 next: function() { |
|
2437 return this._q.shift(); |
|
2438 }, |
|
2439 |
|
2440 /** |
|
2441 * Get the last in the queue. LIFO support. |
|
2442 * |
|
2443 * @method last |
|
2444 * @return {MIXED} the last item in the queue. |
|
2445 */ |
|
2446 last: function() { |
|
2447 return this._q.pop(); |
|
2448 }, |
|
2449 |
|
2450 /** |
|
2451 * Add 0..n items to the end of the queue. |
|
2452 * |
|
2453 * @method add |
|
2454 * @param {MIXED} item* 0..n items. |
|
2455 * @return {object} this queue. |
|
2456 */ |
|
2457 add: function() { |
|
2458 this._q.push.apply(this._q, arguments); |
|
2459 |
|
2460 return this; |
|
2461 }, |
|
2462 |
|
2463 /** |
|
2464 * Returns the current number of queued items. |
|
2465 * |
|
2466 * @method size |
|
2467 * @return {Number} The size. |
|
2468 */ |
|
2469 size: function() { |
|
2470 return this._q.length; |
|
2471 } |
|
2472 }; |
|
2473 |
|
2474 Y.Queue = Queue; |
|
2475 |
|
2476 YUI.Env._loaderQueue = YUI.Env._loaderQueue || new Queue(); |
|
2477 |
|
2478 /** |
|
2479 The YUI module contains the components required for building the YUI seed file. |
|
2480 This includes the script loading mechanism, a simple queue, and the core |
|
2481 utilities for the library. |
|
2482 |
|
2483 @module yui |
|
2484 @submodule yui-base |
|
2485 **/ |
|
2486 |
|
2487 var CACHED_DELIMITER = '__', |
|
2488 |
|
2489 hasOwn = Object.prototype.hasOwnProperty, |
|
2490 isObject = Y.Lang.isObject; |
|
2491 |
|
2492 /** |
|
2493 Returns a wrapper for a function which caches the return value of that function, |
|
2494 keyed off of the combined string representation of the argument values provided |
|
2495 when the wrapper is called. |
|
2496 |
|
2497 Calling this function again with the same arguments will return the cached value |
|
2498 rather than executing the wrapped function. |
|
2499 |
|
2500 Note that since the cache is keyed off of the string representation of arguments |
|
2501 passed to the wrapper function, arguments that aren't strings and don't provide |
|
2502 a meaningful `toString()` method may result in unexpected caching behavior. For |
|
2503 example, the objects `{}` and `{foo: 'bar'}` would both be converted to the |
|
2504 string `[object Object]` when used as a cache key. |
|
2505 |
|
2506 @method cached |
|
2507 @param {Function} source The function to memoize. |
|
2508 @param {Object} [cache={}] Object in which to store cached values. You may seed |
|
2509 this object with pre-existing cached values if desired. |
|
2510 @param {any} [refetch] If supplied, this value is compared with the cached value |
|
2511 using a `==` comparison. If the values are equal, the wrapped function is |
|
2512 executed again even though a cached value exists. |
|
2513 @return {Function} Wrapped function. |
|
2514 @for YUI |
|
2515 **/ |
|
2516 Y.cached = function (source, cache, refetch) { |
|
2517 /*jshint expr: true*/ |
|
2518 cache || (cache = {}); |
|
2519 |
|
2520 return function (arg) { |
|
2521 var key = arguments.length > 1 ? |
|
2522 Array.prototype.join.call(arguments, CACHED_DELIMITER) : |
|
2523 String(arg); |
|
2524 |
|
2525 /*jshint eqeqeq: false*/ |
|
2526 if (!(key in cache) || (refetch && cache[key] == refetch)) { |
|
2527 cache[key] = source.apply(source, arguments); |
|
2528 } |
|
2529 |
|
2530 return cache[key]; |
|
2531 }; |
|
2532 }; |
|
2533 |
|
2534 /** |
|
2535 Returns the `location` object from the window/frame in which this YUI instance |
|
2536 operates, or `undefined` when executing in a non-browser environment |
|
2537 (e.g. Node.js). |
|
2538 |
|
2539 It is _not_ recommended to hold references to the `window.location` object |
|
2540 outside of the scope of a function in which its properties are being accessed or |
|
2541 its methods are being called. This is because of a nasty bug/issue that exists |
|
2542 in both Safari and MobileSafari browsers: |
|
2543 [WebKit Bug 34679](https://bugs.webkit.org/show_bug.cgi?id=34679). |
|
2544 |
|
2545 @method getLocation |
|
2546 @return {location} The `location` object from the window/frame in which this YUI |
|
2547 instance operates. |
|
2548 @since 3.5.0 |
|
2549 **/ |
|
2550 Y.getLocation = function () { |
|
2551 // It is safer to look this up every time because yui-base is attached to a |
|
2552 // YUI instance before a user's config is applied; i.e. `Y.config.win` does |
|
2553 // not point the correct window object when this file is loaded. |
|
2554 var win = Y.config.win; |
|
2555 |
|
2556 // It is not safe to hold a reference to the `location` object outside the |
|
2557 // scope in which it is being used. The WebKit engine used in Safari and |
|
2558 // MobileSafari will "disconnect" the `location` object from the `window` |
|
2559 // when a page is restored from back/forward history cache. |
|
2560 return win && win.location; |
|
2561 }; |
|
2562 |
|
2563 /** |
|
2564 Returns a new object containing all of the properties of all the supplied |
|
2565 objects. The properties from later objects will overwrite those in earlier |
|
2566 objects. |
|
2567 |
|
2568 Passing in a single object will create a shallow copy of it. For a deep copy, |
|
2569 use `clone()`. |
|
2570 |
|
2571 @method merge |
|
2572 @param {Object} objects* One or more objects to merge. |
|
2573 @return {Object} A new merged object. |
|
2574 **/ |
|
2575 Y.merge = function () { |
|
2576 var i = 0, |
|
2577 len = arguments.length, |
|
2578 result = {}, |
|
2579 key, |
|
2580 obj; |
|
2581 |
|
2582 for (; i < len; ++i) { |
|
2583 obj = arguments[i]; |
|
2584 |
|
2585 for (key in obj) { |
|
2586 if (hasOwn.call(obj, key)) { |
|
2587 result[key] = obj[key]; |
|
2588 } |
|
2589 } |
|
2590 } |
|
2591 |
|
2592 return result; |
|
2593 }; |
|
2594 |
|
2595 /** |
|
2596 Mixes _supplier_'s properties into _receiver_. |
|
2597 |
|
2598 Properties on _receiver_ or _receiver_'s prototype will not be overwritten or |
|
2599 shadowed unless the _overwrite_ parameter is `true`, and will not be merged |
|
2600 unless the _merge_ parameter is `true`. |
|
2601 |
|
2602 In the default mode (0), only properties the supplier owns are copied (prototype |
|
2603 properties are not copied). The following copying modes are available: |
|
2604 |
|
2605 * `0`: _Default_. Object to object. |
|
2606 * `1`: Prototype to prototype. |
|
2607 * `2`: Prototype to prototype and object to object. |
|
2608 * `3`: Prototype to object. |
|
2609 * `4`: Object to prototype. |
|
2610 |
|
2611 @method mix |
|
2612 @param {Function|Object} receiver The object or function to receive the mixed |
|
2613 properties. |
|
2614 @param {Function|Object} supplier The object or function supplying the |
|
2615 properties to be mixed. |
|
2616 @param {Boolean} [overwrite=false] If `true`, properties that already exist |
|
2617 on the receiver will be overwritten with properties from the supplier. |
|
2618 @param {String[]} [whitelist] An array of property names to copy. If |
|
2619 specified, only the whitelisted properties will be copied, and all others |
|
2620 will be ignored. |
|
2621 @param {Number} [mode=0] Mix mode to use. See above for available modes. |
|
2622 @param {Boolean} [merge=false] If `true`, objects and arrays that already |
|
2623 exist on the receiver will have the corresponding object/array from the |
|
2624 supplier merged into them, rather than being skipped or overwritten. When |
|
2625 both _overwrite_ and _merge_ are `true`, _merge_ takes precedence. |
|
2626 @return {Function|Object|YUI} The receiver, or the YUI instance if the |
|
2627 specified receiver is falsy. |
|
2628 **/ |
|
2629 Y.mix = function(receiver, supplier, overwrite, whitelist, mode, merge) { |
|
2630 var alwaysOverwrite, exists, from, i, key, len, to; |
|
2631 |
|
2632 // If no supplier is given, we return the receiver. If no receiver is given, |
|
2633 // we return Y. Returning Y doesn't make much sense to me, but it's |
|
2634 // grandfathered in for backcompat reasons. |
|
2635 if (!receiver || !supplier) { |
|
2636 return receiver || Y; |
|
2637 } |
|
2638 |
|
2639 if (mode) { |
|
2640 // In mode 2 (prototype to prototype and object to object), we recurse |
|
2641 // once to do the proto to proto mix. The object to object mix will be |
|
2642 // handled later on. |
|
2643 if (mode === 2) { |
|
2644 Y.mix(receiver.prototype, supplier.prototype, overwrite, |
|
2645 whitelist, 0, merge); |
|
2646 } |
|
2647 |
|
2648 // Depending on which mode is specified, we may be copying from or to |
|
2649 // the prototypes of the supplier and receiver. |
|
2650 from = mode === 1 || mode === 3 ? supplier.prototype : supplier; |
|
2651 to = mode === 1 || mode === 4 ? receiver.prototype : receiver; |
|
2652 |
|
2653 // If either the supplier or receiver doesn't actually have a |
|
2654 // prototype property, then we could end up with an undefined `from` |
|
2655 // or `to`. If that happens, we abort and return the receiver. |
|
2656 if (!from || !to) { |
|
2657 return receiver; |
|
2658 } |
|
2659 } else { |
|
2660 from = supplier; |
|
2661 to = receiver; |
|
2662 } |
|
2663 |
|
2664 // If `overwrite` is truthy and `merge` is falsy, then we can skip a |
|
2665 // property existence check on each iteration and save some time. |
|
2666 alwaysOverwrite = overwrite && !merge; |
|
2667 |
|
2668 if (whitelist) { |
|
2669 for (i = 0, len = whitelist.length; i < len; ++i) { |
|
2670 key = whitelist[i]; |
|
2671 |
|
2672 // We call `Object.prototype.hasOwnProperty` instead of calling |
|
2673 // `hasOwnProperty` on the object itself, since the object's |
|
2674 // `hasOwnProperty` method may have been overridden or removed. |
|
2675 // Also, some native objects don't implement a `hasOwnProperty` |
|
2676 // method. |
|
2677 if (!hasOwn.call(from, key)) { |
|
2678 continue; |
|
2679 } |
|
2680 |
|
2681 // The `key in to` check here is (sadly) intentional for backwards |
|
2682 // compatibility reasons. It prevents undesired shadowing of |
|
2683 // prototype members on `to`. |
|
2684 exists = alwaysOverwrite ? false : key in to; |
|
2685 |
|
2686 if (merge && exists && isObject(to[key], true) |
|
2687 && isObject(from[key], true)) { |
|
2688 // If we're in merge mode, and the key is present on both |
|
2689 // objects, and the value on both objects is either an object or |
|
2690 // an array (but not a function), then we recurse to merge the |
|
2691 // `from` value into the `to` value instead of overwriting it. |
|
2692 // |
|
2693 // Note: It's intentional that the whitelist isn't passed to the |
|
2694 // recursive call here. This is legacy behavior that lots of |
|
2695 // code still depends on. |
|
2696 Y.mix(to[key], from[key], overwrite, null, 0, merge); |
|
2697 } else if (overwrite || !exists) { |
|
2698 // We're not in merge mode, so we'll only copy the `from` value |
|
2699 // to the `to` value if we're in overwrite mode or if the |
|
2700 // current key doesn't exist on the `to` object. |
|
2701 to[key] = from[key]; |
|
2702 } |
|
2703 } |
|
2704 } else { |
|
2705 for (key in from) { |
|
2706 // The code duplication here is for runtime performance reasons. |
|
2707 // Combining whitelist and non-whitelist operations into a single |
|
2708 // loop or breaking the shared logic out into a function both result |
|
2709 // in worse performance, and Y.mix is critical enough that the byte |
|
2710 // tradeoff is worth it. |
|
2711 if (!hasOwn.call(from, key)) { |
|
2712 continue; |
|
2713 } |
|
2714 |
|
2715 // The `key in to` check here is (sadly) intentional for backwards |
|
2716 // compatibility reasons. It prevents undesired shadowing of |
|
2717 // prototype members on `to`. |
|
2718 exists = alwaysOverwrite ? false : key in to; |
|
2719 |
|
2720 if (merge && exists && isObject(to[key], true) |
|
2721 && isObject(from[key], true)) { |
|
2722 Y.mix(to[key], from[key], overwrite, null, 0, merge); |
|
2723 } else if (overwrite || !exists) { |
|
2724 to[key] = from[key]; |
|
2725 } |
|
2726 } |
|
2727 |
|
2728 // If this is an IE browser with the JScript enumeration bug, force |
|
2729 // enumeration of the buggy properties by making a recursive call with |
|
2730 // the buggy properties as the whitelist. |
|
2731 if (Y.Object._hasEnumBug) { |
|
2732 Y.mix(to, from, overwrite, Y.Object._forceEnum, mode, merge); |
|
2733 } |
|
2734 } |
|
2735 |
|
2736 return receiver; |
|
2737 }; |
|
2738 /** |
|
2739 * The YUI module contains the components required for building the YUI |
|
2740 * seed file. This includes the script loading mechanism, a simple queue, |
|
2741 * and the core utilities for the library. |
|
2742 * @module yui |
|
2743 * @submodule yui-base |
|
2744 */ |
|
2745 |
|
2746 /** |
|
2747 * Adds utilities to the YUI instance for working with objects. |
|
2748 * |
|
2749 * @class Object |
|
2750 */ |
|
2751 |
|
2752 var Lang = Y.Lang, |
|
2753 hasOwn = Object.prototype.hasOwnProperty, |
|
2754 |
|
2755 UNDEFINED, // <-- Note the comma. We're still declaring vars. |
|
2756 |
|
2757 /** |
|
2758 * Returns a new object that uses _obj_ as its prototype. This method wraps the |
|
2759 * native ES5 `Object.create()` method if available, but doesn't currently |
|
2760 * pass through `Object.create()`'s second argument (properties) in order to |
|
2761 * ensure compatibility with older browsers. |
|
2762 * |
|
2763 * @method () |
|
2764 * @param {Object} obj Prototype object. |
|
2765 * @return {Object} New object using _obj_ as its prototype. |
|
2766 * @static |
|
2767 */ |
|
2768 O = Y.Object = Lang._isNative(Object.create) ? function (obj) { |
|
2769 // We currently wrap the native Object.create instead of simply aliasing it |
|
2770 // to ensure consistency with our fallback shim, which currently doesn't |
|
2771 // support Object.create()'s second argument (properties). Once we have a |
|
2772 // safe fallback for the properties arg, we can stop wrapping |
|
2773 // Object.create(). |
|
2774 return Object.create(obj); |
|
2775 } : (function () { |
|
2776 // Reusable constructor function for the Object.create() shim. |
|
2777 function F() {} |
|
2778 |
|
2779 // The actual shim. |
|
2780 return function (obj) { |
|
2781 F.prototype = obj; |
|
2782 return new F(); |
|
2783 }; |
|
2784 }()), |
|
2785 |
|
2786 /** |
|
2787 * Property names that IE doesn't enumerate in for..in loops, even when they |
|
2788 * should be enumerable. When `_hasEnumBug` is `true`, it's necessary to |
|
2789 * manually enumerate these properties. |
|
2790 * |
|
2791 * @property _forceEnum |
|
2792 * @type String[] |
|
2793 * @protected |
|
2794 * @static |
|
2795 */ |
|
2796 forceEnum = O._forceEnum = [ |
|
2797 'hasOwnProperty', |
|
2798 'isPrototypeOf', |
|
2799 'propertyIsEnumerable', |
|
2800 'toString', |
|
2801 'toLocaleString', |
|
2802 'valueOf' |
|
2803 ], |
|
2804 |
|
2805 /** |
|
2806 * `true` if this browser has the JScript enumeration bug that prevents |
|
2807 * enumeration of the properties named in the `_forceEnum` array, `false` |
|
2808 * otherwise. |
|
2809 * |
|
2810 * See: |
|
2811 * - <https://developer.mozilla.org/en/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug> |
|
2812 * - <http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation> |
|
2813 * |
|
2814 * @property _hasEnumBug |
|
2815 * @type Boolean |
|
2816 * @protected |
|
2817 * @static |
|
2818 */ |
|
2819 hasEnumBug = O._hasEnumBug = !{valueOf: 0}.propertyIsEnumerable('valueOf'), |
|
2820 |
|
2821 /** |
|
2822 * `true` if this browser incorrectly considers the `prototype` property of |
|
2823 * functions to be enumerable. Currently known to affect Opera 11.50. |
|
2824 * |
|
2825 * @property _hasProtoEnumBug |
|
2826 * @type Boolean |
|
2827 * @protected |
|
2828 * @static |
|
2829 */ |
|
2830 hasProtoEnumBug = O._hasProtoEnumBug = (function () {}).propertyIsEnumerable('prototype'), |
|
2831 |
|
2832 /** |
|
2833 * Returns `true` if _key_ exists on _obj_, `false` if _key_ doesn't exist or |
|
2834 * exists only on _obj_'s prototype. This is essentially a safer version of |
|
2835 * `obj.hasOwnProperty()`. |
|
2836 * |
|
2837 * @method owns |
|
2838 * @param {Object} obj Object to test. |
|
2839 * @param {String} key Property name to look for. |
|
2840 * @return {Boolean} `true` if _key_ exists on _obj_, `false` otherwise. |
|
2841 * @static |
|
2842 */ |
|
2843 owns = O.owns = function (obj, key) { |
|
2844 return !!obj && hasOwn.call(obj, key); |
|
2845 }; // <-- End of var declarations. |
|
2846 |
|
2847 /** |
|
2848 * Alias for `owns()`. |
|
2849 * |
|
2850 * @method hasKey |
|
2851 * @param {Object} obj Object to test. |
|
2852 * @param {String} key Property name to look for. |
|
2853 * @return {Boolean} `true` if _key_ exists on _obj_, `false` otherwise. |
|
2854 * @static |
|
2855 */ |
|
2856 O.hasKey = owns; |
|
2857 |
|
2858 /** |
|
2859 * Returns an array containing the object's enumerable keys. Does not include |
|
2860 * prototype keys or non-enumerable keys. |
|
2861 * |
|
2862 * Note that keys are returned in enumeration order (that is, in the same order |
|
2863 * that they would be enumerated by a `for-in` loop), which may not be the same |
|
2864 * as the order in which they were defined. |
|
2865 * |
|
2866 * This method is an alias for the native ES5 `Object.keys()` method if |
|
2867 * available. |
|
2868 * |
|
2869 * @example |
|
2870 * |
|
2871 * Y.Object.keys({a: 'foo', b: 'bar', c: 'baz'}); |
|
2872 * // => ['a', 'b', 'c'] |
|
2873 * |
|
2874 * @method keys |
|
2875 * @param {Object} obj An object. |
|
2876 * @return {String[]} Array of keys. |
|
2877 * @static |
|
2878 */ |
|
2879 O.keys = Lang._isNative(Object.keys) ? Object.keys : function (obj) { |
|
2880 if (!Lang.isObject(obj)) { |
|
2881 throw new TypeError('Object.keys called on a non-object'); |
|
2882 } |
|
2883 |
|
2884 var keys = [], |
|
2885 i, key, len; |
|
2886 |
|
2887 if (hasProtoEnumBug && typeof obj === 'function') { |
|
2888 for (key in obj) { |
|
2889 if (owns(obj, key) && key !== 'prototype') { |
|
2890 keys.push(key); |
|
2891 } |
|
2892 } |
|
2893 } else { |
|
2894 for (key in obj) { |
|
2895 if (owns(obj, key)) { |
|
2896 keys.push(key); |
|
2897 } |
|
2898 } |
|
2899 } |
|
2900 |
|
2901 if (hasEnumBug) { |
|
2902 for (i = 0, len = forceEnum.length; i < len; ++i) { |
|
2903 key = forceEnum[i]; |
|
2904 |
|
2905 if (owns(obj, key)) { |
|
2906 keys.push(key); |
|
2907 } |
|
2908 } |
|
2909 } |
|
2910 |
|
2911 return keys; |
|
2912 }; |
|
2913 |
|
2914 /** |
|
2915 * Returns an array containing the values of the object's enumerable keys. |
|
2916 * |
|
2917 * Note that values are returned in enumeration order (that is, in the same |
|
2918 * order that they would be enumerated by a `for-in` loop), which may not be the |
|
2919 * same as the order in which they were defined. |
|
2920 * |
|
2921 * @example |
|
2922 * |
|
2923 * Y.Object.values({a: 'foo', b: 'bar', c: 'baz'}); |
|
2924 * // => ['foo', 'bar', 'baz'] |
|
2925 * |
|
2926 * @method values |
|
2927 * @param {Object} obj An object. |
|
2928 * @return {Array} Array of values. |
|
2929 * @static |
|
2930 */ |
|
2931 O.values = function (obj) { |
|
2932 var keys = O.keys(obj), |
|
2933 i = 0, |
|
2934 len = keys.length, |
|
2935 values = []; |
|
2936 |
|
2937 for (; i < len; ++i) { |
|
2938 values.push(obj[keys[i]]); |
|
2939 } |
|
2940 |
|
2941 return values; |
|
2942 }; |
|
2943 |
|
2944 /** |
|
2945 * Returns the number of enumerable keys owned by an object. |
|
2946 * |
|
2947 * @method size |
|
2948 * @param {Object} obj An object. |
|
2949 * @return {Number} The object's size. |
|
2950 * @static |
|
2951 */ |
|
2952 O.size = function (obj) { |
|
2953 try { |
|
2954 return O.keys(obj).length; |
|
2955 } catch (ex) { |
|
2956 return 0; // Legacy behavior for non-objects. |
|
2957 } |
|
2958 }; |
|
2959 |
|
2960 /** |
|
2961 * Returns `true` if the object owns an enumerable property with the specified |
|
2962 * value. |
|
2963 * |
|
2964 * @method hasValue |
|
2965 * @param {Object} obj An object. |
|
2966 * @param {any} value The value to search for. |
|
2967 * @return {Boolean} `true` if _obj_ contains _value_, `false` otherwise. |
|
2968 * @static |
|
2969 */ |
|
2970 O.hasValue = function (obj, value) { |
|
2971 return Y.Array.indexOf(O.values(obj), value) > -1; |
|
2972 }; |
|
2973 |
|
2974 /** |
|
2975 * Executes a function on each enumerable property in _obj_. The function |
|
2976 * receives the value, the key, and the object itself as parameters (in that |
|
2977 * order). |
|
2978 * |
|
2979 * By default, only properties owned by _obj_ are enumerated. To include |
|
2980 * prototype properties, set the _proto_ parameter to `true`. |
|
2981 * |
|
2982 * @method each |
|
2983 * @param {Object} obj Object to enumerate. |
|
2984 * @param {Function} fn Function to execute on each enumerable property. |
|
2985 * @param {mixed} fn.value Value of the current property. |
|
2986 * @param {String} fn.key Key of the current property. |
|
2987 * @param {Object} fn.obj Object being enumerated. |
|
2988 * @param {Object} [thisObj] `this` object to use when calling _fn_. |
|
2989 * @param {Boolean} [proto=false] Include prototype properties. |
|
2990 * @return {YUI} the YUI instance. |
|
2991 * @chainable |
|
2992 * @static |
|
2993 */ |
|
2994 O.each = function (obj, fn, thisObj, proto) { |
|
2995 var key; |
|
2996 |
|
2997 for (key in obj) { |
|
2998 if (proto || owns(obj, key)) { |
|
2999 fn.call(thisObj || Y, obj[key], key, obj); |
|
3000 } |
|
3001 } |
|
3002 |
|
3003 return Y; |
|
3004 }; |
|
3005 |
|
3006 /** |
|
3007 * Executes a function on each enumerable property in _obj_, but halts if the |
|
3008 * function returns a truthy value. The function receives the value, the key, |
|
3009 * and the object itself as paramters (in that order). |
|
3010 * |
|
3011 * By default, only properties owned by _obj_ are enumerated. To include |
|
3012 * prototype properties, set the _proto_ parameter to `true`. |
|
3013 * |
|
3014 * @method some |
|
3015 * @param {Object} obj Object to enumerate. |
|
3016 * @param {Function} fn Function to execute on each enumerable property. |
|
3017 * @param {mixed} fn.value Value of the current property. |
|
3018 * @param {String} fn.key Key of the current property. |
|
3019 * @param {Object} fn.obj Object being enumerated. |
|
3020 * @param {Object} [thisObj] `this` object to use when calling _fn_. |
|
3021 * @param {Boolean} [proto=false] Include prototype properties. |
|
3022 * @return {Boolean} `true` if any execution of _fn_ returns a truthy value, |
|
3023 * `false` otherwise. |
|
3024 * @static |
|
3025 */ |
|
3026 O.some = function (obj, fn, thisObj, proto) { |
|
3027 var key; |
|
3028 |
|
3029 for (key in obj) { |
|
3030 if (proto || owns(obj, key)) { |
|
3031 if (fn.call(thisObj || Y, obj[key], key, obj)) { |
|
3032 return true; |
|
3033 } |
|
3034 } |
|
3035 } |
|
3036 |
|
3037 return false; |
|
3038 }; |
|
3039 |
|
3040 /** |
|
3041 * Retrieves the sub value at the provided path, |
|
3042 * from the value object provided. |
|
3043 * |
|
3044 * @method getValue |
|
3045 * @static |
|
3046 * @param o The object from which to extract the property value. |
|
3047 * @param path {Array} A path array, specifying the object traversal path |
|
3048 * from which to obtain the sub value. |
|
3049 * @return {Any} The value stored in the path, undefined if not found, |
|
3050 * undefined if the source is not an object. Returns the source object |
|
3051 * if an empty path is provided. |
|
3052 */ |
|
3053 O.getValue = function(o, path) { |
|
3054 if (!Lang.isObject(o)) { |
|
3055 return UNDEFINED; |
|
3056 } |
|
3057 |
|
3058 var i, |
|
3059 p = Y.Array(path), |
|
3060 l = p.length; |
|
3061 |
|
3062 for (i = 0; o !== UNDEFINED && i < l; i++) { |
|
3063 o = o[p[i]]; |
|
3064 } |
|
3065 |
|
3066 return o; |
|
3067 }; |
|
3068 |
|
3069 /** |
|
3070 * Sets the sub-attribute value at the provided path on the |
|
3071 * value object. Returns the modified value object, or |
|
3072 * undefined if the path is invalid. |
|
3073 * |
|
3074 * @method setValue |
|
3075 * @static |
|
3076 * @param o The object on which to set the sub value. |
|
3077 * @param path {Array} A path array, specifying the object traversal path |
|
3078 * at which to set the sub value. |
|
3079 * @param val {Any} The new value for the sub-attribute. |
|
3080 * @return {Object} The modified object, with the new sub value set, or |
|
3081 * undefined, if the path was invalid. |
|
3082 */ |
|
3083 O.setValue = function(o, path, val) { |
|
3084 var i, |
|
3085 p = Y.Array(path), |
|
3086 leafIdx = p.length - 1, |
|
3087 ref = o; |
|
3088 |
|
3089 if (leafIdx >= 0) { |
|
3090 for (i = 0; ref !== UNDEFINED && i < leafIdx; i++) { |
|
3091 ref = ref[p[i]]; |
|
3092 } |
|
3093 |
|
3094 if (ref !== UNDEFINED) { |
|
3095 ref[p[i]] = val; |
|
3096 } else { |
|
3097 return UNDEFINED; |
|
3098 } |
|
3099 } |
|
3100 |
|
3101 return o; |
|
3102 }; |
|
3103 |
|
3104 /** |
|
3105 * Returns `true` if the object has no enumerable properties of its own. |
|
3106 * |
|
3107 * @method isEmpty |
|
3108 * @param {Object} obj An object. |
|
3109 * @return {Boolean} `true` if the object is empty. |
|
3110 * @static |
|
3111 * @since 3.2.0 |
|
3112 */ |
|
3113 O.isEmpty = function (obj) { |
|
3114 return !O.keys(Object(obj)).length; |
|
3115 }; |
|
3116 /** |
|
3117 * The YUI module contains the components required for building the YUI seed |
|
3118 * file. This includes the script loading mechanism, a simple queue, and the |
|
3119 * core utilities for the library. |
|
3120 * @module yui |
|
3121 * @submodule yui-base |
|
3122 */ |
|
3123 |
|
3124 /** |
|
3125 * YUI user agent detection. |
|
3126 * Do not fork for a browser if it can be avoided. Use feature detection when |
|
3127 * you can. Use the user agent as a last resort. For all fields listed |
|
3128 * as @type float, UA stores a version number for the browser engine, |
|
3129 * 0 otherwise. This value may or may not map to the version number of |
|
3130 * the browser using the engine. The value is presented as a float so |
|
3131 * that it can easily be used for boolean evaluation as well as for |
|
3132 * looking for a particular range of versions. Because of this, |
|
3133 * some of the granularity of the version info may be lost. The fields that |
|
3134 * are @type string default to null. The API docs list the values that |
|
3135 * these fields can have. |
|
3136 * @class UA |
|
3137 * @static |
|
3138 */ |
|
3139 |
|
3140 /** |
|
3141 * Static method on `YUI.Env` for parsing a UA string. Called at instantiation |
|
3142 * to populate `Y.UA`. |
|
3143 * |
|
3144 * @static |
|
3145 * @method parseUA |
|
3146 * @param {String} [subUA=navigator.userAgent] UA string to parse |
|
3147 * @return {Object} The Y.UA object |
|
3148 */ |
|
3149 YUI.Env.parseUA = function(subUA) { |
|
3150 |
|
3151 var numberify = function(s) { |
|
3152 var c = 0; |
|
3153 return parseFloat(s.replace(/\./g, function() { |
|
3154 return (c++ === 1) ? '' : '.'; |
|
3155 })); |
|
3156 }, |
|
3157 |
|
3158 win = Y.config.win, |
|
3159 |
|
3160 nav = win && win.navigator, |
|
3161 |
|
3162 o = { |
|
3163 |
|
3164 /** |
|
3165 * Internet Explorer version number or 0. Example: 6 |
|
3166 * @property ie |
|
3167 * @type float |
|
3168 * @static |
|
3169 */ |
|
3170 ie: 0, |
|
3171 |
|
3172 /** |
|
3173 * Opera version number or 0. Example: 9.2 |
|
3174 * @property opera |
|
3175 * @type float |
|
3176 * @static |
|
3177 */ |
|
3178 opera: 0, |
|
3179 |
|
3180 /** |
|
3181 * Gecko engine revision number. Will evaluate to 1 if Gecko |
|
3182 * is detected but the revision could not be found. Other browsers |
|
3183 * will be 0. Example: 1.8 |
|
3184 * <pre> |
|
3185 * Firefox 1.0.0.4: 1.7.8 <-- Reports 1.7 |
|
3186 * Firefox 1.5.0.9: 1.8.0.9 <-- 1.8 |
|
3187 * Firefox 2.0.0.3: 1.8.1.3 <-- 1.81 |
|
3188 * Firefox 3.0 <-- 1.9 |
|
3189 * Firefox 3.5 <-- 1.91 |
|
3190 * </pre> |
|
3191 * @property gecko |
|
3192 * @type float |
|
3193 * @static |
|
3194 */ |
|
3195 gecko: 0, |
|
3196 |
|
3197 /** |
|
3198 * AppleWebKit version. KHTML browsers that are not WebKit browsers |
|
3199 * will evaluate to 1, other browsers 0. Example: 418.9 |
|
3200 * <pre> |
|
3201 * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the |
|
3202 * latest available for Mac OSX 10.3. |
|
3203 * Safari 2.0.2: 416 <-- hasOwnProperty introduced |
|
3204 * Safari 2.0.4: 418 <-- preventDefault fixed |
|
3205 * Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run |
|
3206 * different versions of webkit |
|
3207 * Safari 2.0.4 (419.3): 419 <-- Tiger installations that have been |
|
3208 * updated, but not updated |
|
3209 * to the latest patch. |
|
3210 * Webkit 212 nightly: 522+ <-- Safari 3.0 precursor (with native |
|
3211 * SVG and many major issues fixed). |
|
3212 * Safari 3.0.4 (523.12) 523.12 <-- First Tiger release - automatic |
|
3213 * update from 2.x via the 10.4.11 OS patch. |
|
3214 * Webkit nightly 1/2008:525+ <-- Supports DOMContentLoaded event. |
|
3215 * yahoo.com user agent hack removed. |
|
3216 * </pre> |
|
3217 * http://en.wikipedia.org/wiki/Safari_version_history |
|
3218 * @property webkit |
|
3219 * @type float |
|
3220 * @static |
|
3221 */ |
|
3222 webkit: 0, |
|
3223 |
|
3224 /** |
|
3225 * Safari will be detected as webkit, but this property will also |
|
3226 * be populated with the Safari version number |
|
3227 * @property safari |
|
3228 * @type float |
|
3229 * @static |
|
3230 */ |
|
3231 safari: 0, |
|
3232 |
|
3233 /** |
|
3234 * Chrome will be detected as webkit, but this property will also |
|
3235 * be populated with the Chrome version number |
|
3236 * @property chrome |
|
3237 * @type float |
|
3238 * @static |
|
3239 */ |
|
3240 chrome: 0, |
|
3241 |
|
3242 /** |
|
3243 * The mobile property will be set to a string containing any relevant |
|
3244 * user agent information when a modern mobile browser is detected. |
|
3245 * Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series |
|
3246 * devices with the WebKit-based browser, and Opera Mini. |
|
3247 * @property mobile |
|
3248 * @type string |
|
3249 * @default null |
|
3250 * @static |
|
3251 */ |
|
3252 mobile: null, |
|
3253 |
|
3254 /** |
|
3255 * Adobe AIR version number or 0. Only populated if webkit is detected. |
|
3256 * Example: 1.0 |
|
3257 * @property air |
|
3258 * @type float |
|
3259 */ |
|
3260 air: 0, |
|
3261 /** |
|
3262 * PhantomJS version number or 0. Only populated if webkit is detected. |
|
3263 * Example: 1.0 |
|
3264 * @property phantomjs |
|
3265 * @type float |
|
3266 */ |
|
3267 phantomjs: 0, |
|
3268 /** |
|
3269 * Detects Apple iPad's OS version |
|
3270 * @property ipad |
|
3271 * @type float |
|
3272 * @static |
|
3273 */ |
|
3274 ipad: 0, |
|
3275 /** |
|
3276 * Detects Apple iPhone's OS version |
|
3277 * @property iphone |
|
3278 * @type float |
|
3279 * @static |
|
3280 */ |
|
3281 iphone: 0, |
|
3282 /** |
|
3283 * Detects Apples iPod's OS version |
|
3284 * @property ipod |
|
3285 * @type float |
|
3286 * @static |
|
3287 */ |
|
3288 ipod: 0, |
|
3289 /** |
|
3290 * General truthy check for iPad, iPhone or iPod |
|
3291 * @property ios |
|
3292 * @type Boolean |
|
3293 * @default null |
|
3294 * @static |
|
3295 */ |
|
3296 ios: null, |
|
3297 /** |
|
3298 * Detects Googles Android OS version |
|
3299 * @property android |
|
3300 * @type float |
|
3301 * @static |
|
3302 */ |
|
3303 android: 0, |
|
3304 /** |
|
3305 * Detects Kindle Silk |
|
3306 * @property silk |
|
3307 * @type float |
|
3308 * @static |
|
3309 */ |
|
3310 silk: 0, |
|
3311 /** |
|
3312 * Detects Kindle Silk Acceleration |
|
3313 * @property accel |
|
3314 * @type Boolean |
|
3315 * @static |
|
3316 */ |
|
3317 accel: false, |
|
3318 /** |
|
3319 * Detects Palms WebOS version |
|
3320 * @property webos |
|
3321 * @type float |
|
3322 * @static |
|
3323 */ |
|
3324 webos: 0, |
|
3325 |
|
3326 /** |
|
3327 * Google Caja version number or 0. |
|
3328 * @property caja |
|
3329 * @type float |
|
3330 */ |
|
3331 caja: nav && nav.cajaVersion, |
|
3332 |
|
3333 /** |
|
3334 * Set to true if the page appears to be in SSL |
|
3335 * @property secure |
|
3336 * @type boolean |
|
3337 * @static |
|
3338 */ |
|
3339 secure: false, |
|
3340 |
|
3341 /** |
|
3342 * The operating system. Currently only detecting windows or macintosh |
|
3343 * @property os |
|
3344 * @type string |
|
3345 * @default null |
|
3346 * @static |
|
3347 */ |
|
3348 os: null, |
|
3349 |
|
3350 /** |
|
3351 * The Nodejs Version |
|
3352 * @property nodejs |
|
3353 * @type float |
|
3354 * @default 0 |
|
3355 * @static |
|
3356 */ |
|
3357 nodejs: 0, |
|
3358 /** |
|
3359 * Window8/IE10 Application host environment |
|
3360 * @property winjs |
|
3361 * @type Boolean |
|
3362 * @static |
|
3363 */ |
|
3364 winjs: !!((typeof Windows !== "undefined") && Windows.System), |
|
3365 /** |
|
3366 * Are touch/msPointer events available on this device |
|
3367 * @property touchEnabled |
|
3368 * @type Boolean |
|
3369 * @static |
|
3370 */ |
|
3371 touchEnabled: false |
|
3372 }, |
|
3373 |
|
3374 ua = subUA || nav && nav.userAgent, |
|
3375 |
|
3376 loc = win && win.location, |
|
3377 |
|
3378 href = loc && loc.href, |
|
3379 |
|
3380 m; |
|
3381 |
|
3382 /** |
|
3383 * The User Agent string that was parsed |
|
3384 * @property userAgent |
|
3385 * @type String |
|
3386 * @static |
|
3387 */ |
|
3388 o.userAgent = ua; |
|
3389 |
|
3390 |
|
3391 o.secure = href && (href.toLowerCase().indexOf('https') === 0); |
|
3392 |
|
3393 if (ua) { |
|
3394 |
|
3395 if ((/windows|win32/i).test(ua)) { |
|
3396 o.os = 'windows'; |
|
3397 } else if ((/macintosh|mac_powerpc/i).test(ua)) { |
|
3398 o.os = 'macintosh'; |
|
3399 } else if ((/android/i).test(ua)) { |
|
3400 o.os = 'android'; |
|
3401 } else if ((/symbos/i).test(ua)) { |
|
3402 o.os = 'symbos'; |
|
3403 } else if ((/linux/i).test(ua)) { |
|
3404 o.os = 'linux'; |
|
3405 } else if ((/rhino/i).test(ua)) { |
|
3406 o.os = 'rhino'; |
|
3407 } |
|
3408 |
|
3409 // Modern KHTML browsers should qualify as Safari X-Grade |
|
3410 if ((/KHTML/).test(ua)) { |
|
3411 o.webkit = 1; |
|
3412 } |
|
3413 if ((/IEMobile|XBLWP7/).test(ua)) { |
|
3414 o.mobile = 'windows'; |
|
3415 } |
|
3416 if ((/Fennec/).test(ua)) { |
|
3417 o.mobile = 'gecko'; |
|
3418 } |
|
3419 // Modern WebKit browsers are at least X-Grade |
|
3420 m = ua.match(/AppleWebKit\/([^\s]*)/); |
|
3421 if (m && m[1]) { |
|
3422 o.webkit = numberify(m[1]); |
|
3423 o.safari = o.webkit; |
|
3424 |
|
3425 if (/PhantomJS/.test(ua)) { |
|
3426 m = ua.match(/PhantomJS\/([^\s]*)/); |
|
3427 if (m && m[1]) { |
|
3428 o.phantomjs = numberify(m[1]); |
|
3429 } |
|
3430 } |
|
3431 |
|
3432 // Mobile browser check |
|
3433 if (/ Mobile\//.test(ua) || (/iPad|iPod|iPhone/).test(ua)) { |
|
3434 o.mobile = 'Apple'; // iPhone or iPod Touch |
|
3435 |
|
3436 m = ua.match(/OS ([^\s]*)/); |
|
3437 if (m && m[1]) { |
|
3438 m = numberify(m[1].replace('_', '.')); |
|
3439 } |
|
3440 o.ios = m; |
|
3441 o.os = 'ios'; |
|
3442 o.ipad = o.ipod = o.iphone = 0; |
|
3443 |
|
3444 m = ua.match(/iPad|iPod|iPhone/); |
|
3445 if (m && m[0]) { |
|
3446 o[m[0].toLowerCase()] = o.ios; |
|
3447 } |
|
3448 } else { |
|
3449 m = ua.match(/NokiaN[^\/]*|webOS\/\d\.\d/); |
|
3450 if (m) { |
|
3451 // Nokia N-series, webOS, ex: NokiaN95 |
|
3452 o.mobile = m[0]; |
|
3453 } |
|
3454 if (/webOS/.test(ua)) { |
|
3455 o.mobile = 'WebOS'; |
|
3456 m = ua.match(/webOS\/([^\s]*);/); |
|
3457 if (m && m[1]) { |
|
3458 o.webos = numberify(m[1]); |
|
3459 } |
|
3460 } |
|
3461 if (/ Android/.test(ua)) { |
|
3462 if (/Mobile/.test(ua)) { |
|
3463 o.mobile = 'Android'; |
|
3464 } |
|
3465 m = ua.match(/Android ([^\s]*);/); |
|
3466 if (m && m[1]) { |
|
3467 o.android = numberify(m[1]); |
|
3468 } |
|
3469 |
|
3470 } |
|
3471 if (/Silk/.test(ua)) { |
|
3472 m = ua.match(/Silk\/([^\s]*)\)/); |
|
3473 if (m && m[1]) { |
|
3474 o.silk = numberify(m[1]); |
|
3475 } |
|
3476 if (!o.android) { |
|
3477 o.android = 2.34; //Hack for desktop mode in Kindle |
|
3478 o.os = 'Android'; |
|
3479 } |
|
3480 if (/Accelerated=true/.test(ua)) { |
|
3481 o.accel = true; |
|
3482 } |
|
3483 } |
|
3484 } |
|
3485 |
|
3486 m = ua.match(/(Chrome|CrMo|CriOS)\/([^\s]*)/); |
|
3487 if (m && m[1] && m[2]) { |
|
3488 o.chrome = numberify(m[2]); // Chrome |
|
3489 o.safari = 0; //Reset safari back to 0 |
|
3490 if (m[1] === 'CrMo') { |
|
3491 o.mobile = 'chrome'; |
|
3492 } |
|
3493 } else { |
|
3494 m = ua.match(/AdobeAIR\/([^\s]*)/); |
|
3495 if (m) { |
|
3496 o.air = m[0]; // Adobe AIR 1.0 or better |
|
3497 } |
|
3498 } |
|
3499 } |
|
3500 |
|
3501 if (!o.webkit) { // not webkit |
|
3502 // @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr) |
|
3503 if (/Opera/.test(ua)) { |
|
3504 m = ua.match(/Opera[\s\/]([^\s]*)/); |
|
3505 if (m && m[1]) { |
|
3506 o.opera = numberify(m[1]); |
|
3507 } |
|
3508 m = ua.match(/Version\/([^\s]*)/); |
|
3509 if (m && m[1]) { |
|
3510 o.opera = numberify(m[1]); // opera 10+ |
|
3511 } |
|
3512 |
|
3513 if (/Opera Mobi/.test(ua)) { |
|
3514 o.mobile = 'opera'; |
|
3515 m = ua.replace('Opera Mobi', '').match(/Opera ([^\s]*)/); |
|
3516 if (m && m[1]) { |
|
3517 o.opera = numberify(m[1]); |
|
3518 } |
|
3519 } |
|
3520 m = ua.match(/Opera Mini[^;]*/); |
|
3521 |
|
3522 if (m) { |
|
3523 o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316 |
|
3524 } |
|
3525 } else { // not opera or webkit |
|
3526 m = ua.match(/MSIE\s([^;]*)/); |
|
3527 if (m && m[1]) { |
|
3528 o.ie = numberify(m[1]); |
|
3529 } else { // not opera, webkit, or ie |
|
3530 m = ua.match(/Gecko\/([^\s]*)/); |
|
3531 if (m) { |
|
3532 o.gecko = 1; // Gecko detected, look for revision |
|
3533 m = ua.match(/rv:([^\s\)]*)/); |
|
3534 if (m && m[1]) { |
|
3535 o.gecko = numberify(m[1]); |
|
3536 if (/Mobile|Tablet/.test(ua)) { |
|
3537 o.mobile = "ffos"; |
|
3538 } |
|
3539 } |
|
3540 } |
|
3541 } |
|
3542 } |
|
3543 } |
|
3544 } |
|
3545 |
|
3546 //Check for known properties to tell if touch events are enabled on this device or if |
|
3547 //the number of MSPointer touchpoints on this device is greater than 0. |
|
3548 if (win && nav && !(o.chrome && o.chrome < 6)) { |
|
3549 o.touchEnabled = (("ontouchstart" in win) || (("msMaxTouchPoints" in nav) && (nav.msMaxTouchPoints > 0))); |
|
3550 } |
|
3551 |
|
3552 //It was a parsed UA, do not assign the global value. |
|
3553 if (!subUA) { |
|
3554 |
|
3555 if (typeof process === 'object') { |
|
3556 |
|
3557 if (process.versions && process.versions.node) { |
|
3558 //NodeJS |
|
3559 o.os = process.platform; |
|
3560 o.nodejs = numberify(process.versions.node); |
|
3561 } |
|
3562 } |
|
3563 |
|
3564 YUI.Env.UA = o; |
|
3565 |
|
3566 } |
|
3567 |
|
3568 return o; |
|
3569 }; |
|
3570 |
|
3571 |
|
3572 Y.UA = YUI.Env.UA || YUI.Env.parseUA(); |
|
3573 |
|
3574 /** |
|
3575 Performs a simple comparison between two version numbers, accounting for |
|
3576 standard versioning logic such as the fact that "535.8" is a lower version than |
|
3577 "535.24", even though a simple numerical comparison would indicate that it's |
|
3578 greater. Also accounts for cases such as "1.1" vs. "1.1.0", which are |
|
3579 considered equivalent. |
|
3580 |
|
3581 Returns -1 if version _a_ is lower than version _b_, 0 if they're equivalent, |
|
3582 1 if _a_ is higher than _b_. |
|
3583 |
|
3584 Versions may be numbers or strings containing numbers and dots. For example, |
|
3585 both `535` and `"535.8.10"` are acceptable. A version string containing |
|
3586 non-numeric characters, like `"535.8.beta"`, may produce unexpected results. |
|
3587 |
|
3588 @method compareVersions |
|
3589 @param {Number|String} a First version number to compare. |
|
3590 @param {Number|String} b Second version number to compare. |
|
3591 @return -1 if _a_ is lower than _b_, 0 if they're equivalent, 1 if _a_ is |
|
3592 higher than _b_. |
|
3593 **/ |
|
3594 Y.UA.compareVersions = function (a, b) { |
|
3595 var aPart, aParts, bPart, bParts, i, len; |
|
3596 |
|
3597 if (a === b) { |
|
3598 return 0; |
|
3599 } |
|
3600 |
|
3601 aParts = (a + '').split('.'); |
|
3602 bParts = (b + '').split('.'); |
|
3603 |
|
3604 for (i = 0, len = Math.max(aParts.length, bParts.length); i < len; ++i) { |
|
3605 aPart = parseInt(aParts[i], 10); |
|
3606 bPart = parseInt(bParts[i], 10); |
|
3607 |
|
3608 /*jshint expr: true*/ |
|
3609 isNaN(aPart) && (aPart = 0); |
|
3610 isNaN(bPart) && (bPart = 0); |
|
3611 |
|
3612 if (aPart < bPart) { |
|
3613 return -1; |
|
3614 } |
|
3615 |
|
3616 if (aPart > bPart) { |
|
3617 return 1; |
|
3618 } |
|
3619 } |
|
3620 |
|
3621 return 0; |
|
3622 }; |
|
3623 YUI.Env.aliases = { |
|
3624 "anim": ["anim-base","anim-color","anim-curve","anim-easing","anim-node-plugin","anim-scroll","anim-xy"], |
|
3625 "anim-shape-transform": ["anim-shape"], |
|
3626 "app": ["app-base","app-content","app-transitions","lazy-model-list","model","model-list","model-sync-rest","router","view","view-node-map"], |
|
3627 "attribute": ["attribute-base","attribute-complex"], |
|
3628 "attribute-events": ["attribute-observable"], |
|
3629 "autocomplete": ["autocomplete-base","autocomplete-sources","autocomplete-list","autocomplete-plugin"], |
|
3630 "axes": ["axis-numeric","axis-category","axis-time","axis-stacked"], |
|
3631 "axes-base": ["axis-numeric-base","axis-category-base","axis-time-base","axis-stacked-base"], |
|
3632 "base": ["base-base","base-pluginhost","base-build"], |
|
3633 "cache": ["cache-base","cache-offline","cache-plugin"], |
|
3634 "charts": ["charts-base"], |
|
3635 "collection": ["array-extras","arraylist","arraylist-add","arraylist-filter","array-invoke"], |
|
3636 "color": ["color-base","color-hsl","color-harmony"], |
|
3637 "controller": ["router"], |
|
3638 "dataschema": ["dataschema-base","dataschema-json","dataschema-xml","dataschema-array","dataschema-text"], |
|
3639 "datasource": ["datasource-local","datasource-io","datasource-get","datasource-function","datasource-cache","datasource-jsonschema","datasource-xmlschema","datasource-arrayschema","datasource-textschema","datasource-polling"], |
|
3640 "datatable": ["datatable-core","datatable-table","datatable-head","datatable-body","datatable-base","datatable-column-widths","datatable-message","datatable-mutable","datatable-sort","datatable-datasource"], |
|
3641 "datatype": ["datatype-date","datatype-number","datatype-xml"], |
|
3642 "datatype-date": ["datatype-date-parse","datatype-date-format","datatype-date-math"], |
|
3643 "datatype-number": ["datatype-number-parse","datatype-number-format"], |
|
3644 "datatype-xml": ["datatype-xml-parse","datatype-xml-format"], |
|
3645 "dd": ["dd-ddm-base","dd-ddm","dd-ddm-drop","dd-drag","dd-proxy","dd-constrain","dd-drop","dd-scroll","dd-delegate"], |
|
3646 "dom": ["dom-base","dom-screen","dom-style","selector-native","selector"], |
|
3647 "editor": ["frame","editor-selection","exec-command","editor-base","editor-para","editor-br","editor-bidi","editor-tab","createlink-base"], |
|
3648 "event": ["event-base","event-delegate","event-synthetic","event-mousewheel","event-mouseenter","event-key","event-focus","event-resize","event-hover","event-outside","event-touch","event-move","event-flick","event-valuechange","event-tap"], |
|
3649 "event-custom": ["event-custom-base","event-custom-complex"], |
|
3650 "event-gestures": ["event-flick","event-move"], |
|
3651 "handlebars": ["handlebars-compiler"], |
|
3652 "highlight": ["highlight-base","highlight-accentfold"], |
|
3653 "history": ["history-base","history-hash","history-hash-ie","history-html5"], |
|
3654 "io": ["io-base","io-xdr","io-form","io-upload-iframe","io-queue"], |
|
3655 "json": ["json-parse","json-stringify"], |
|
3656 "loader": ["loader-base","loader-rollup","loader-yui3"], |
|
3657 "node": ["node-base","node-event-delegate","node-pluginhost","node-screen","node-style"], |
|
3658 "pluginhost": ["pluginhost-base","pluginhost-config"], |
|
3659 "querystring": ["querystring-parse","querystring-stringify"], |
|
3660 "recordset": ["recordset-base","recordset-sort","recordset-filter","recordset-indexer"], |
|
3661 "resize": ["resize-base","resize-proxy","resize-constrain"], |
|
3662 "slider": ["slider-base","slider-value-range","clickable-rail","range-slider"], |
|
3663 "template": ["template-base","template-micro"], |
|
3664 "text": ["text-accentfold","text-wordbreak"], |
|
3665 "widget": ["widget-base","widget-htmlparser","widget-skin","widget-uievents"] |
|
3666 }; |
|
3667 |
|
3668 |
|
3669 }, '3.10.3', { |
|
3670 "use": [ |
|
3671 "yui-base", |
|
3672 "get", |
|
3673 "features", |
|
3674 "intl-base", |
|
3675 "yui-log", |
|
3676 "yui-log-nodejs", |
|
3677 "yui-later", |
|
3678 "loader-base", |
|
3679 "loader-rollup", |
|
3680 "loader-yui3" |
|
3681 ] |
|
3682 }); |
|
3683 YUI.add('get', function (Y, NAME) { |
|
3684 |
|
3685 /** |
|
3686 * NodeJS specific Get module used to load remote resources. |
|
3687 * It contains the same signature as the default Get module so there is no code change needed. |
|
3688 * @module get-nodejs |
|
3689 * @class GetNodeJS |
|
3690 */ |
|
3691 |
|
3692 var Module = require('module'), |
|
3693 |
|
3694 path = require('path'), |
|
3695 fs = require('fs'), |
|
3696 request = require('request'), |
|
3697 end = function(cb, msg, result) { |
|
3698 if (Y.Lang.isFunction(cb.onEnd)) { |
|
3699 cb.onEnd.call(Y, msg, result); |
|
3700 } |
|
3701 }, pass = function(cb) { |
|
3702 if (Y.Lang.isFunction(cb.onSuccess)) { |
|
3703 cb.onSuccess.call(Y, cb); |
|
3704 } |
|
3705 end(cb, 'success', 'success'); |
|
3706 }, fail = function(cb, er) { |
|
3707 er.errors = [er]; |
|
3708 if (Y.Lang.isFunction(cb.onFailure)) { |
|
3709 cb.onFailure.call(Y, er, cb); |
|
3710 } |
|
3711 end(cb, er, 'fail'); |
|
3712 }; |
|
3713 |
|
3714 |
|
3715 Y.Get = function() { |
|
3716 }; |
|
3717 |
|
3718 //Setup the default config base path |
|
3719 Y.config.base = path.join(__dirname, '../'); |
|
3720 |
|
3721 YUI.require = require; |
|
3722 YUI.process = process; |
|
3723 |
|
3724 /** |
|
3725 * Takes the raw JS files and wraps them to be executed in the YUI context so they can be loaded |
|
3726 * into the YUI object |
|
3727 * @method _exec |
|
3728 * @private |
|
3729 * @param {String} data The JS to execute |
|
3730 * @param {String} url The path to the file that was parsed |
|
3731 * @param {Callback} cb The callback to execute when this is completed |
|
3732 * @param {Error} cb.err=null Error object |
|
3733 * @param {String} cb.url The URL that was just parsed |
|
3734 */ |
|
3735 |
|
3736 Y.Get._exec = function(data, url, cb) { |
|
3737 if (data.charCodeAt(0) === 0xFEFF) { |
|
3738 data = data.slice(1); |
|
3739 } |
|
3740 |
|
3741 var mod = new Module(url, module); |
|
3742 mod.filename = url; |
|
3743 mod.paths = Module._nodeModulePaths(path.dirname(url)); |
|
3744 if (typeof YUI._getLoadHook === 'function') { |
|
3745 data = YUI._getLoadHook(data, url); |
|
3746 } |
|
3747 mod._compile('module.exports = function (YUI) {' + data + '\n;return YUI;};', url); |
|
3748 |
|
3749 /*global YUI:true */ |
|
3750 YUI = mod.exports(YUI); |
|
3751 |
|
3752 mod.loaded = true; |
|
3753 |
|
3754 cb(null, url); |
|
3755 }; |
|
3756 |
|
3757 /** |
|
3758 * Fetches the content from a remote URL or a file from disc and passes the content |
|
3759 * off to `_exec` for parsing |
|
3760 * @method _include |
|
3761 * @private |
|
3762 * @param {String} url The URL/File path to fetch the content from |
|
3763 * @param {Callback} cb The callback to fire once the content has been executed via `_exec` |
|
3764 */ |
|
3765 Y.Get._include = function (url, cb) { |
|
3766 var cfg, |
|
3767 mod, |
|
3768 self = this; |
|
3769 |
|
3770 if (url.match(/^https?:\/\//)) { |
|
3771 cfg = { |
|
3772 url: url, |
|
3773 timeout: self.timeout |
|
3774 }; |
|
3775 request(cfg, function (err, response, body) { |
|
3776 if (err) { |
|
3777 cb(err, url); |
|
3778 } else { |
|
3779 Y.Get._exec(body, url, cb); |
|
3780 } |
|
3781 }); |
|
3782 } else { |
|
3783 try { |
|
3784 // Try to resolve paths relative to the module that required yui. |
|
3785 url = Module._findPath(url, Module._resolveLookupPaths(url, module.parent.parent)[1]); |
|
3786 |
|
3787 if (Y.config.useSync) { |
|
3788 //Needs to be in useSync |
|
3789 mod = fs.readFileSync(url,'utf8'); |
|
3790 } else { |
|
3791 fs.readFile(url, 'utf8', function (err, mod) { |
|
3792 if (err) { |
|
3793 cb(err, url); |
|
3794 } else { |
|
3795 Y.Get._exec(mod, url, cb); |
|
3796 } |
|
3797 }); |
|
3798 return; |
|
3799 } |
|
3800 } catch (err) { |
|
3801 cb(err, url); |
|
3802 return; |
|
3803 } |
|
3804 |
|
3805 Y.Get._exec(mod, url, cb); |
|
3806 } |
|
3807 }; |
|
3808 |
|
3809 |
|
3810 /** |
|
3811 * Override for Get.script for loading local or remote YUI modules. |
|
3812 * @method js |
|
3813 * @param {Array|String} s The URL's to load into this context |
|
3814 * @param {Object} options Transaction options |
|
3815 */ |
|
3816 Y.Get.js = function(s, options) { |
|
3817 var urls = Y.Array(s), url, i, l = urls.length, c= 0, |
|
3818 check = function() { |
|
3819 if (c === l) { |
|
3820 pass(options); |
|
3821 } |
|
3822 }; |
|
3823 |
|
3824 |
|
3825 /*jshint loopfunc: true */ |
|
3826 for (i=0; i<l; i++) { |
|
3827 url = urls[i]; |
|
3828 if (Y.Lang.isObject(url)) { |
|
3829 url = url.url; |
|
3830 } |
|
3831 |
|
3832 url = url.replace(/'/g, '%27'); |
|
3833 Y.Get._include(url, function(err, url) { |
|
3834 if (!Y.config) { |
|
3835 Y.config = { |
|
3836 debug: true |
|
3837 }; |
|
3838 } |
|
3839 if (options.onProgress) { |
|
3840 options.onProgress.call(options.context || Y, url); |
|
3841 } |
|
3842 if (err) { |
|
3843 fail(options, err); |
|
3844 } else { |
|
3845 c++; |
|
3846 check(); |
|
3847 } |
|
3848 }); |
|
3849 } |
|
3850 |
|
3851 //Keeping Signature in the browser. |
|
3852 return { |
|
3853 execute: function() {} |
|
3854 }; |
|
3855 }; |
|
3856 |
|
3857 /** |
|
3858 * Alias for `Y.Get.js` |
|
3859 * @method script |
|
3860 */ |
|
3861 Y.Get.script = Y.Get.js; |
|
3862 |
|
3863 //Place holder for SS Dom access |
|
3864 Y.Get.css = function(s, cb) { |
|
3865 pass(cb); |
|
3866 }; |
|
3867 |
|
3868 |
|
3869 |
|
3870 }, '3.10.3'); |
|
3871 YUI.add('features', function (Y, NAME) { |
|
3872 |
|
3873 var feature_tests = {}; |
|
3874 |
|
3875 /** |
|
3876 Contains the core of YUI's feature test architecture. |
|
3877 @module features |
|
3878 */ |
|
3879 |
|
3880 /** |
|
3881 * Feature detection |
|
3882 * @class Features |
|
3883 * @static |
|
3884 */ |
|
3885 |
|
3886 Y.mix(Y.namespace('Features'), { |
|
3887 |
|
3888 /** |
|
3889 * Object hash of all registered feature tests |
|
3890 * @property tests |
|
3891 * @type Object |
|
3892 */ |
|
3893 tests: feature_tests, |
|
3894 |
|
3895 /** |
|
3896 * Add a test to the system |
|
3897 * |
|
3898 * ``` |
|
3899 * Y.Features.add("load", "1", {}); |
|
3900 * ``` |
|
3901 * |
|
3902 * @method add |
|
3903 * @param {String} cat The category, right now only 'load' is supported |
|
3904 * @param {String} name The number sequence of the test, how it's reported in the URL or config: 1, 2, 3 |
|
3905 * @param {Object} o Object containing test properties |
|
3906 * @param {String} o.name The name of the test |
|
3907 * @param {Function} o.test The test function to execute, the only argument to the function is the `Y` instance |
|
3908 * @param {String} o.trigger The module that triggers this test. |
|
3909 */ |
|
3910 add: function(cat, name, o) { |
|
3911 feature_tests[cat] = feature_tests[cat] || {}; |
|
3912 feature_tests[cat][name] = o; |
|
3913 }, |
|
3914 /** |
|
3915 * Execute all tests of a given category and return the serialized results |
|
3916 * |
|
3917 * ``` |
|
3918 * caps=1:1;2:1;3:0 |
|
3919 * ``` |
|
3920 * @method all |
|
3921 * @param {String} cat The category to execute |
|
3922 * @param {Array} args The arguments to pass to the test function |
|
3923 * @return {String} A semi-colon separated string of tests and their success/failure: 1:1;2:1;3:0 |
|
3924 */ |
|
3925 all: function(cat, args) { |
|
3926 var cat_o = feature_tests[cat], |
|
3927 // results = {}; |
|
3928 result = []; |
|
3929 if (cat_o) { |
|
3930 Y.Object.each(cat_o, function(v, k) { |
|
3931 result.push(k + ':' + (Y.Features.test(cat, k, args) ? 1 : 0)); |
|
3932 }); |
|
3933 } |
|
3934 |
|
3935 return (result.length) ? result.join(';') : ''; |
|
3936 }, |
|
3937 /** |
|
3938 * Run a sepecific test and return a Boolean response. |
|
3939 * |
|
3940 * ``` |
|
3941 * Y.Features.test("load", "1"); |
|
3942 * ``` |
|
3943 * |
|
3944 * @method test |
|
3945 * @param {String} cat The category of the test to run |
|
3946 * @param {String} name The name of the test to run |
|
3947 * @param {Array} args The arguments to pass to the test function |
|
3948 * @return {Boolean} True or false if the test passed/failed. |
|
3949 */ |
|
3950 test: function(cat, name, args) { |
|
3951 args = args || []; |
|
3952 var result, ua, test, |
|
3953 cat_o = feature_tests[cat], |
|
3954 feature = cat_o && cat_o[name]; |
|
3955 |
|
3956 if (!feature) { |
|
3957 } else { |
|
3958 |
|
3959 result = feature.result; |
|
3960 |
|
3961 if (Y.Lang.isUndefined(result)) { |
|
3962 |
|
3963 ua = feature.ua; |
|
3964 if (ua) { |
|
3965 result = (Y.UA[ua]); |
|
3966 } |
|
3967 |
|
3968 test = feature.test; |
|
3969 if (test && ((!ua) || result)) { |
|
3970 result = test.apply(Y, args); |
|
3971 } |
|
3972 |
|
3973 feature.result = result; |
|
3974 } |
|
3975 } |
|
3976 |
|
3977 return result; |
|
3978 } |
|
3979 }); |
|
3980 |
|
3981 // Y.Features.add("load", "1", {}); |
|
3982 // Y.Features.test("load", "1"); |
|
3983 // caps=1:1;2:0;3:1; |
|
3984 |
|
3985 /* This file is auto-generated by (yogi loader --yes --mix --start ../) */ |
|
3986 /*jshint maxlen:900, eqeqeq: false */ |
|
3987 var add = Y.Features.add; |
|
3988 // app-transitions-native |
|
3989 add('load', '0', { |
|
3990 "name": "app-transitions-native", |
|
3991 "test": function (Y) { |
|
3992 var doc = Y.config.doc, |
|
3993 node = doc ? doc.documentElement : null; |
|
3994 |
|
3995 if (node && node.style) { |
|
3996 return ('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); |
|
3997 } |
|
3998 |
|
3999 return false; |
|
4000 }, |
|
4001 "trigger": "app-transitions" |
|
4002 }); |
|
4003 // autocomplete-list-keys |
|
4004 add('load', '1', { |
|
4005 "name": "autocomplete-list-keys", |
|
4006 "test": function (Y) { |
|
4007 // Only add keyboard support to autocomplete-list if this doesn't appear to |
|
4008 // be an iOS or Android-based mobile device. |
|
4009 // |
|
4010 // There's currently no feasible way to actually detect whether a device has |
|
4011 // a hardware keyboard, so this sniff will have to do. It can easily be |
|
4012 // overridden by manually loading the autocomplete-list-keys module. |
|
4013 // |
|
4014 // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari |
|
4015 // doesn't fire the keyboard events used by AutoCompleteList, so there's |
|
4016 // no point loading the -keys module even when a bluetooth keyboard may be |
|
4017 // available. |
|
4018 return !(Y.UA.ios || Y.UA.android); |
|
4019 }, |
|
4020 "trigger": "autocomplete-list" |
|
4021 }); |
|
4022 // dd-gestures |
|
4023 add('load', '2', { |
|
4024 "name": "dd-gestures", |
|
4025 "trigger": "dd-drag", |
|
4026 "ua": "touchEnabled" |
|
4027 }); |
|
4028 // dom-style-ie |
|
4029 add('load', '3', { |
|
4030 "name": "dom-style-ie", |
|
4031 "test": function (Y) { |
|
4032 |
|
4033 var testFeature = Y.Features.test, |
|
4034 addFeature = Y.Features.add, |
|
4035 WINDOW = Y.config.win, |
|
4036 DOCUMENT = Y.config.doc, |
|
4037 DOCUMENT_ELEMENT = 'documentElement', |
|
4038 ret = false; |
|
4039 |
|
4040 addFeature('style', 'computedStyle', { |
|
4041 test: function() { |
|
4042 return WINDOW && 'getComputedStyle' in WINDOW; |
|
4043 } |
|
4044 }); |
|
4045 |
|
4046 addFeature('style', 'opacity', { |
|
4047 test: function() { |
|
4048 return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style; |
|
4049 } |
|
4050 }); |
|
4051 |
|
4052 ret = (!testFeature('style', 'opacity') && |
|
4053 !testFeature('style', 'computedStyle')); |
|
4054 |
|
4055 return ret; |
|
4056 }, |
|
4057 "trigger": "dom-style" |
|
4058 }); |
|
4059 // editor-para-ie |
|
4060 add('load', '4', { |
|
4061 "name": "editor-para-ie", |
|
4062 "trigger": "editor-para", |
|
4063 "ua": "ie", |
|
4064 "when": "instead" |
|
4065 }); |
|
4066 // event-base-ie |
|
4067 add('load', '5', { |
|
4068 "name": "event-base-ie", |
|
4069 "test": function(Y) { |
|
4070 var imp = Y.config.doc && Y.config.doc.implementation; |
|
4071 return (imp && (!imp.hasFeature('Events', '2.0'))); |
|
4072 }, |
|
4073 "trigger": "node-base" |
|
4074 }); |
|
4075 // graphics-canvas |
|
4076 add('load', '6', { |
|
4077 "name": "graphics-canvas", |
|
4078 "test": function(Y) { |
|
4079 var DOCUMENT = Y.config.doc, |
|
4080 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", |
|
4081 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), |
|
4082 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); |
|
4083 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); |
|
4084 }, |
|
4085 "trigger": "graphics" |
|
4086 }); |
|
4087 // graphics-canvas-default |
|
4088 add('load', '7', { |
|
4089 "name": "graphics-canvas-default", |
|
4090 "test": function(Y) { |
|
4091 var DOCUMENT = Y.config.doc, |
|
4092 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", |
|
4093 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), |
|
4094 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); |
|
4095 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); |
|
4096 }, |
|
4097 "trigger": "graphics" |
|
4098 }); |
|
4099 // graphics-svg |
|
4100 add('load', '8', { |
|
4101 "name": "graphics-svg", |
|
4102 "test": function(Y) { |
|
4103 var DOCUMENT = Y.config.doc, |
|
4104 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", |
|
4105 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), |
|
4106 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); |
|
4107 |
|
4108 return svg && (useSVG || !canvas); |
|
4109 }, |
|
4110 "trigger": "graphics" |
|
4111 }); |
|
4112 // graphics-svg-default |
|
4113 add('load', '9', { |
|
4114 "name": "graphics-svg-default", |
|
4115 "test": function(Y) { |
|
4116 var DOCUMENT = Y.config.doc, |
|
4117 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", |
|
4118 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), |
|
4119 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); |
|
4120 |
|
4121 return svg && (useSVG || !canvas); |
|
4122 }, |
|
4123 "trigger": "graphics" |
|
4124 }); |
|
4125 // graphics-vml |
|
4126 add('load', '10', { |
|
4127 "name": "graphics-vml", |
|
4128 "test": function(Y) { |
|
4129 var DOCUMENT = Y.config.doc, |
|
4130 canvas = DOCUMENT && DOCUMENT.createElement("canvas"); |
|
4131 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); |
|
4132 }, |
|
4133 "trigger": "graphics" |
|
4134 }); |
|
4135 // graphics-vml-default |
|
4136 add('load', '11', { |
|
4137 "name": "graphics-vml-default", |
|
4138 "test": function(Y) { |
|
4139 var DOCUMENT = Y.config.doc, |
|
4140 canvas = DOCUMENT && DOCUMENT.createElement("canvas"); |
|
4141 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); |
|
4142 }, |
|
4143 "trigger": "graphics" |
|
4144 }); |
|
4145 // history-hash-ie |
|
4146 add('load', '12', { |
|
4147 "name": "history-hash-ie", |
|
4148 "test": function (Y) { |
|
4149 var docMode = Y.config.doc && Y.config.doc.documentMode; |
|
4150 |
|
4151 return Y.UA.ie && (!('onhashchange' in Y.config.win) || |
|
4152 !docMode || docMode < 8); |
|
4153 }, |
|
4154 "trigger": "history-hash" |
|
4155 }); |
|
4156 // io-nodejs |
|
4157 add('load', '13', { |
|
4158 "name": "io-nodejs", |
|
4159 "trigger": "io-base", |
|
4160 "ua": "nodejs" |
|
4161 }); |
|
4162 // json-parse-shim |
|
4163 add('load', '14', { |
|
4164 "name": "json-parse-shim", |
|
4165 "test": function (Y) { |
|
4166 var _JSON = Y.config.global.JSON, |
|
4167 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, |
|
4168 nativeSupport = Y.config.useNativeJSONParse !== false && !!Native; |
|
4169 |
|
4170 function workingNative( k, v ) { |
|
4171 return k === "ok" ? true : v; |
|
4172 } |
|
4173 |
|
4174 // Double check basic functionality. This is mainly to catch early broken |
|
4175 // implementations of the JSON API in Firefox 3.1 beta1 and beta2 |
|
4176 if ( nativeSupport ) { |
|
4177 try { |
|
4178 nativeSupport = ( Native.parse( '{"ok":false}', workingNative ) ).ok; |
|
4179 } |
|
4180 catch ( e ) { |
|
4181 nativeSupport = false; |
|
4182 } |
|
4183 } |
|
4184 |
|
4185 return !nativeSupport; |
|
4186 }, |
|
4187 "trigger": "json-parse" |
|
4188 }); |
|
4189 // json-stringify-shim |
|
4190 add('load', '15', { |
|
4191 "name": "json-stringify-shim", |
|
4192 "test": function (Y) { |
|
4193 var _JSON = Y.config.global.JSON, |
|
4194 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, |
|
4195 nativeSupport = Y.config.useNativeJSONStringify !== false && !!Native; |
|
4196 |
|
4197 // Double check basic native functionality. This is primarily to catch broken |
|
4198 // early JSON API implementations in Firefox 3.1 beta1 and beta2. |
|
4199 if ( nativeSupport ) { |
|
4200 try { |
|
4201 nativeSupport = ( '0' === Native.stringify(0) ); |
|
4202 } catch ( e ) { |
|
4203 nativeSupport = false; |
|
4204 } |
|
4205 } |
|
4206 |
|
4207 |
|
4208 return !nativeSupport; |
|
4209 }, |
|
4210 "trigger": "json-stringify" |
|
4211 }); |
|
4212 // scrollview-base-ie |
|
4213 add('load', '16', { |
|
4214 "name": "scrollview-base-ie", |
|
4215 "trigger": "scrollview-base", |
|
4216 "ua": "ie" |
|
4217 }); |
|
4218 // selector-css2 |
|
4219 add('load', '17', { |
|
4220 "name": "selector-css2", |
|
4221 "test": function (Y) { |
|
4222 var DOCUMENT = Y.config.doc, |
|
4223 ret = DOCUMENT && !('querySelectorAll' in DOCUMENT); |
|
4224 |
|
4225 return ret; |
|
4226 }, |
|
4227 "trigger": "selector" |
|
4228 }); |
|
4229 // transition-timer |
|
4230 add('load', '18', { |
|
4231 "name": "transition-timer", |
|
4232 "test": function (Y) { |
|
4233 var DOCUMENT = Y.config.doc, |
|
4234 node = (DOCUMENT) ? DOCUMENT.documentElement: null, |
|
4235 ret = true; |
|
4236 |
|
4237 if (node && node.style) { |
|
4238 ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); |
|
4239 } |
|
4240 |
|
4241 return ret; |
|
4242 }, |
|
4243 "trigger": "transition" |
|
4244 }); |
|
4245 // widget-base-ie |
|
4246 add('load', '19', { |
|
4247 "name": "widget-base-ie", |
|
4248 "trigger": "widget-base", |
|
4249 "ua": "ie" |
|
4250 }); |
|
4251 // yql-jsonp |
|
4252 add('load', '20', { |
|
4253 "name": "yql-jsonp", |
|
4254 "test": function (Y) { |
|
4255 /* Only load the JSONP module when not in nodejs or winjs |
|
4256 TODO Make the winjs module a CORS module |
|
4257 */ |
|
4258 return (!Y.UA.nodejs && !Y.UA.winjs); |
|
4259 }, |
|
4260 "trigger": "yql", |
|
4261 "when": "after" |
|
4262 }); |
|
4263 // yql-nodejs |
|
4264 add('load', '21', { |
|
4265 "name": "yql-nodejs", |
|
4266 "trigger": "yql", |
|
4267 "ua": "nodejs", |
|
4268 "when": "after" |
|
4269 }); |
|
4270 // yql-winjs |
|
4271 add('load', '22', { |
|
4272 "name": "yql-winjs", |
|
4273 "trigger": "yql", |
|
4274 "ua": "winjs", |
|
4275 "when": "after" |
|
4276 }); |
|
4277 |
|
4278 }, '3.10.3', {"requires": ["yui-base"]}); |
|
4279 YUI.add('intl-base', function (Y, NAME) { |
|
4280 |
|
4281 /** |
|
4282 * The Intl utility provides a central location for managing sets of |
|
4283 * localized resources (strings and formatting patterns). |
|
4284 * |
|
4285 * @class Intl |
|
4286 * @uses EventTarget |
|
4287 * @static |
|
4288 */ |
|
4289 |
|
4290 var SPLIT_REGEX = /[, ]/; |
|
4291 |
|
4292 Y.mix(Y.namespace('Intl'), { |
|
4293 |
|
4294 /** |
|
4295 * Returns the language among those available that |
|
4296 * best matches the preferred language list, using the Lookup |
|
4297 * algorithm of BCP 47. |
|
4298 * If none of the available languages meets the user's preferences, |
|
4299 * then "" is returned. |
|
4300 * Extended language ranges are not supported. |
|
4301 * |
|
4302 * @method lookupBestLang |
|
4303 * @param {String[] | String} preferredLanguages The list of preferred |
|
4304 * languages in descending preference order, represented as BCP 47 |
|
4305 * language tags. A string array or a comma-separated list. |
|
4306 * @param {String[]} availableLanguages The list of languages |
|
4307 * that the application supports, represented as BCP 47 language |
|
4308 * tags. |
|
4309 * |
|
4310 * @return {String} The available language that best matches the |
|
4311 * preferred language list, or "". |
|
4312 * @since 3.1.0 |
|
4313 */ |
|
4314 lookupBestLang: function(preferredLanguages, availableLanguages) { |
|
4315 |
|
4316 var i, language, result, index; |
|
4317 |
|
4318 // check whether the list of available languages contains language; |
|
4319 // if so return it |
|
4320 function scan(language) { |
|
4321 var i; |
|
4322 for (i = 0; i < availableLanguages.length; i += 1) { |
|
4323 if (language.toLowerCase() === |
|
4324 availableLanguages[i].toLowerCase()) { |
|
4325 return availableLanguages[i]; |
|
4326 } |
|
4327 } |
|
4328 } |
|
4329 |
|
4330 if (Y.Lang.isString(preferredLanguages)) { |
|
4331 preferredLanguages = preferredLanguages.split(SPLIT_REGEX); |
|
4332 } |
|
4333 |
|
4334 for (i = 0; i < preferredLanguages.length; i += 1) { |
|
4335 language = preferredLanguages[i]; |
|
4336 if (!language || language === '*') { |
|
4337 continue; |
|
4338 } |
|
4339 // check the fallback sequence for one language |
|
4340 while (language.length > 0) { |
|
4341 result = scan(language); |
|
4342 if (result) { |
|
4343 return result; |
|
4344 } else { |
|
4345 index = language.lastIndexOf('-'); |
|
4346 if (index >= 0) { |
|
4347 language = language.substring(0, index); |
|
4348 // one-character subtags get cut along with the |
|
4349 // following subtag |
|
4350 if (index >= 2 && language.charAt(index - 2) === '-') { |
|
4351 language = language.substring(0, index - 2); |
|
4352 } |
|
4353 } else { |
|
4354 // nothing available for this language |
|
4355 break; |
|
4356 } |
|
4357 } |
|
4358 } |
|
4359 } |
|
4360 |
|
4361 return ''; |
|
4362 } |
|
4363 }); |
|
4364 |
|
4365 |
|
4366 }, '3.10.3', {"requires": ["yui-base"]}); |
|
4367 YUI.add('yui-log', function (Y, NAME) { |
|
4368 |
|
4369 /** |
|
4370 * Provides console log capability and exposes a custom event for |
|
4371 * console implementations. This module is a `core` YUI module, |
|
4372 * <a href="../classes/YUI.html#method_log">it's documentation is located under the YUI class</a>. |
|
4373 * |
|
4374 * @module yui |
|
4375 * @submodule yui-log |
|
4376 */ |
|
4377 |
|
4378 var INSTANCE = Y, |
|
4379 LOGEVENT = 'yui:log', |
|
4380 UNDEFINED = 'undefined', |
|
4381 LEVELS = { debug: 1, |
|
4382 info: 2, |
|
4383 warn: 4, |
|
4384 error: 8 }; |
|
4385 |
|
4386 /** |
|
4387 * If the 'debug' config is true, a 'yui:log' event will be |
|
4388 * dispatched, which the Console widget and anything else |
|
4389 * can consume. If the 'useBrowserConsole' config is true, it will |
|
4390 * write to the browser console if available. YUI-specific log |
|
4391 * messages will only be present in the -debug versions of the |
|
4392 * JS files. The build system is supposed to remove log statements |
|
4393 * from the raw and minified versions of the files. |
|
4394 * |
|
4395 * @method log |
|
4396 * @for YUI |
|
4397 * @param {String} msg The message to log. |
|
4398 * @param {String} cat The log category for the message. Default |
|
4399 * categories are "info", "warn", "error", time". |
|
4400 * Custom categories can be used as well. (opt). |
|
4401 * @param {String} src The source of the the message (opt). |
|
4402 * @param {boolean} silent If true, the log event won't fire. |
|
4403 * @return {YUI} YUI instance. |
|
4404 */ |
|
4405 INSTANCE.log = function(msg, cat, src, silent) { |
|
4406 var bail, excl, incl, m, f, minlevel, |
|
4407 Y = INSTANCE, |
|
4408 c = Y.config, |
|
4409 publisher = (Y.fire) ? Y : YUI.Env.globalEvents; |
|
4410 // suppress log message if the config is off or the event stack |
|
4411 // or the event call stack contains a consumer of the yui:log event |
|
4412 if (c.debug) { |
|
4413 // apply source filters |
|
4414 src = src || ""; |
|
4415 if (typeof src !== "undefined") { |
|
4416 excl = c.logExclude; |
|
4417 incl = c.logInclude; |
|
4418 if (incl && !(src in incl)) { |
|
4419 bail = 1; |
|
4420 } else if (incl && (src in incl)) { |
|
4421 bail = !incl[src]; |
|
4422 } else if (excl && (src in excl)) { |
|
4423 bail = excl[src]; |
|
4424 } |
|
4425 |
|
4426 // Determine the current minlevel as defined in configuration |
|
4427 Y.config.logLevel = Y.config.logLevel || 'debug'; |
|
4428 minlevel = LEVELS[Y.config.logLevel.toLowerCase()]; |
|
4429 |
|
4430 if (cat in LEVELS && LEVELS[cat] < minlevel) { |
|
4431 // Skip this message if the we don't meet the defined minlevel |
|
4432 bail = 1; |
|
4433 } |
|
4434 } |
|
4435 if (!bail) { |
|
4436 if (c.useBrowserConsole) { |
|
4437 m = (src) ? src + ': ' + msg : msg; |
|
4438 if (Y.Lang.isFunction(c.logFn)) { |
|
4439 c.logFn.call(Y, msg, cat, src); |
|
4440 } else if (typeof console !== UNDEFINED && console.log) { |
|
4441 f = (cat && console[cat] && (cat in LEVELS)) ? cat : 'log'; |
|
4442 console[f](m); |
|
4443 } else if (typeof opera !== UNDEFINED) { |
|
4444 opera.postError(m); |
|
4445 } |
|
4446 } |
|
4447 |
|
4448 if (publisher && !silent) { |
|
4449 |
|
4450 if (publisher === Y && (!publisher.getEvent(LOGEVENT))) { |
|
4451 publisher.publish(LOGEVENT, { |
|
4452 broadcast: 2 |
|
4453 }); |
|
4454 } |
|
4455 |
|
4456 publisher.fire(LOGEVENT, { |
|
4457 msg: msg, |
|
4458 cat: cat, |
|
4459 src: src |
|
4460 }); |
|
4461 } |
|
4462 } |
|
4463 } |
|
4464 |
|
4465 return Y; |
|
4466 }; |
|
4467 |
|
4468 /** |
|
4469 * Write a system message. This message will be preserved in the |
|
4470 * minified and raw versions of the YUI files, unlike log statements. |
|
4471 * @method message |
|
4472 * @for YUI |
|
4473 * @param {String} msg The message to log. |
|
4474 * @param {String} cat The log category for the message. Default |
|
4475 * categories are "info", "warn", "error", time". |
|
4476 * Custom categories can be used as well. (opt). |
|
4477 * @param {String} src The source of the the message (opt). |
|
4478 * @param {boolean} silent If true, the log event won't fire. |
|
4479 * @return {YUI} YUI instance. |
|
4480 */ |
|
4481 INSTANCE.message = function() { |
|
4482 return INSTANCE.log.apply(INSTANCE, arguments); |
|
4483 }; |
|
4484 |
|
4485 |
|
4486 }, '3.10.3', {"requires": ["yui-base"]}); |
|
4487 YUI.add('yui-log-nodejs', function (Y, NAME) { |
|
4488 |
|
4489 var sys = require(process.binding('natives').util ? 'util' : 'sys'), |
|
4490 hasColor = false; |
|
4491 |
|
4492 try { |
|
4493 var stdio = require("stdio"); |
|
4494 hasColor = stdio.isStderrATTY(); |
|
4495 } catch (ex) { |
|
4496 hasColor = true; |
|
4497 } |
|
4498 |
|
4499 Y.config.useColor = hasColor; |
|
4500 |
|
4501 Y.consoleColor = function(str, num) { |
|
4502 if (!this.config.useColor) { |
|
4503 return str; |
|
4504 } |
|
4505 if (!num) { |
|
4506 num = '32'; |
|
4507 } |
|
4508 return "\u001b[" + num +"m" + str + "\u001b[0m"; |
|
4509 }; |
|
4510 |
|
4511 |
|
4512 var logFn = function(str, t, m) { |
|
4513 var id = '', lvl, mLvl; |
|
4514 if (this.id) { |
|
4515 id = '[' + this.id + ']:'; |
|
4516 } |
|
4517 t = t || 'info'; |
|
4518 m = (m) ? this.consoleColor(' (' + m.toLowerCase() + '):', 35) : ''; |
|
4519 |
|
4520 if (str === null) { |
|
4521 str = 'null'; |
|
4522 } |
|
4523 |
|
4524 if ((typeof str === 'object') || str instanceof Array) { |
|
4525 try { |
|
4526 //Should we use this? |
|
4527 if (str.tagName || str._yuid || str._query) { |
|
4528 str = str.toString(); |
|
4529 } else { |
|
4530 str = sys.inspect(str); |
|
4531 } |
|
4532 } catch (e) { |
|
4533 //Fail catcher |
|
4534 } |
|
4535 } |
|
4536 |
|
4537 lvl = '37;40'; |
|
4538 mLvl = ((str) ? '' : 31); |
|
4539 t = t+''; //Force to a string.. |
|
4540 switch (t.toLowerCase()) { |
|
4541 case 'error': |
|
4542 lvl = mLvl = 31; |
|
4543 break; |
|
4544 case 'warn': |
|
4545 lvl = 33; |
|
4546 break; |
|
4547 case 'debug': |
|
4548 lvl = 34; |
|
4549 break; |
|
4550 } |
|
4551 if (typeof str === 'string') { |
|
4552 if (str && str.indexOf("\n") !== -1) { |
|
4553 str = "\n" + str; |
|
4554 } |
|
4555 } |
|
4556 |
|
4557 // output log messages to stderr |
|
4558 sys.error(this.consoleColor(t.toLowerCase() + ':', lvl) + m + ' ' + this.consoleColor(str, mLvl)); |
|
4559 }; |
|
4560 |
|
4561 if (!Y.config.logFn) { |
|
4562 Y.config.logFn = logFn; |
|
4563 } |
|
4564 |
|
4565 |
|
4566 |
|
4567 }, '3.10.3'); |
|
4568 YUI.add('yui-later', function (Y, NAME) { |
|
4569 |
|
4570 /** |
|
4571 * Provides a setTimeout/setInterval wrapper. This module is a `core` YUI module, |
|
4572 * <a href="../classes/YUI.html#method_later">it's documentation is located under the YUI class</a>. |
|
4573 * |
|
4574 * @module yui |
|
4575 * @submodule yui-later |
|
4576 */ |
|
4577 |
|
4578 var NO_ARGS = []; |
|
4579 |
|
4580 /** |
|
4581 * Executes the supplied function in the context of the supplied |
|
4582 * object 'when' milliseconds later. Executes the function a |
|
4583 * single time unless periodic is set to true. |
|
4584 * @for YUI |
|
4585 * @method later |
|
4586 * @param when {int} the number of milliseconds to wait until the fn |
|
4587 * is executed. |
|
4588 * @param o the context object. |
|
4589 * @param fn {Function|String} the function to execute or the name of |
|
4590 * the method in the 'o' object to execute. |
|
4591 * @param data [Array] data that is provided to the function. This |
|
4592 * accepts either a single item or an array. If an array is provided, |
|
4593 * the function is executed with one parameter for each array item. |
|
4594 * If you need to pass a single array parameter, it needs to be wrapped |
|
4595 * in an array [myarray]. |
|
4596 * |
|
4597 * Note: native methods in IE may not have the call and apply methods. |
|
4598 * In this case, it will work, but you are limited to four arguments. |
|
4599 * |
|
4600 * @param periodic {boolean} if true, executes continuously at supplied |
|
4601 * interval until canceled. |
|
4602 * @return {object} a timer object. Call the cancel() method on this |
|
4603 * object to stop the timer. |
|
4604 */ |
|
4605 Y.later = function(when, o, fn, data, periodic) { |
|
4606 when = when || 0; |
|
4607 data = (!Y.Lang.isUndefined(data)) ? Y.Array(data) : NO_ARGS; |
|
4608 o = o || Y.config.win || Y; |
|
4609 |
|
4610 var cancelled = false, |
|
4611 method = (o && Y.Lang.isString(fn)) ? o[fn] : fn, |
|
4612 wrapper = function() { |
|
4613 // IE 8- may execute a setInterval callback one last time |
|
4614 // after clearInterval was called, so in order to preserve |
|
4615 // the cancel() === no more runny-run, we have to jump through |
|
4616 // an extra hoop. |
|
4617 if (!cancelled) { |
|
4618 if (!method.apply) { |
|
4619 method(data[0], data[1], data[2], data[3]); |
|
4620 } else { |
|
4621 method.apply(o, data || NO_ARGS); |
|
4622 } |
|
4623 } |
|
4624 }, |
|
4625 id = (periodic) ? setInterval(wrapper, when) : setTimeout(wrapper, when); |
|
4626 |
|
4627 return { |
|
4628 id: id, |
|
4629 interval: periodic, |
|
4630 cancel: function() { |
|
4631 cancelled = true; |
|
4632 if (this.interval) { |
|
4633 clearInterval(id); |
|
4634 } else { |
|
4635 clearTimeout(id); |
|
4636 } |
|
4637 } |
|
4638 }; |
|
4639 }; |
|
4640 |
|
4641 Y.Lang.later = Y.later; |
|
4642 |
|
4643 |
|
4644 |
|
4645 }, '3.10.3', {"requires": ["yui-base"]}); |
|
4646 YUI.add('loader-base', function (Y, NAME) { |
|
4647 |
|
4648 /** |
|
4649 * The YUI loader core |
|
4650 * @module loader |
|
4651 * @submodule loader-base |
|
4652 */ |
|
4653 |
|
4654 if (!YUI.Env[Y.version]) { |
|
4655 |
|
4656 (function() { |
|
4657 var VERSION = Y.version, |
|
4658 BUILD = '/build/', |
|
4659 ROOT = VERSION + '/', |
|
4660 CDN_BASE = Y.Env.base, |
|
4661 GALLERY_VERSION = 'gallery-2013.06.05-22-14', |
|
4662 TNT = '2in3', |
|
4663 TNT_VERSION = '4', |
|
4664 YUI2_VERSION = '2.9.0', |
|
4665 COMBO_BASE = CDN_BASE + 'combo?', |
|
4666 META = { version: VERSION, |
|
4667 root: ROOT, |
|
4668 base: Y.Env.base, |
|
4669 comboBase: COMBO_BASE, |
|
4670 skin: { defaultSkin: 'sam', |
|
4671 base: 'assets/skins/', |
|
4672 path: 'skin.css', |
|
4673 after: ['cssreset', |
|
4674 'cssfonts', |
|
4675 'cssgrids', |
|
4676 'cssbase', |
|
4677 'cssreset-context', |
|
4678 'cssfonts-context']}, |
|
4679 groups: {}, |
|
4680 patterns: {} }, |
|
4681 groups = META.groups, |
|
4682 yui2Update = function(tnt, yui2, config) { |
|
4683 |
|
4684 var root = TNT + '.' + |
|
4685 (tnt || TNT_VERSION) + '/' + |
|
4686 (yui2 || YUI2_VERSION) + BUILD, |
|
4687 base = (config && config.base) ? config.base : CDN_BASE, |
|
4688 combo = (config && config.comboBase) ? config.comboBase : COMBO_BASE; |
|
4689 |
|
4690 groups.yui2.base = base + root; |
|
4691 groups.yui2.root = root; |
|
4692 groups.yui2.comboBase = combo; |
|
4693 }, |
|
4694 galleryUpdate = function(tag, config) { |
|
4695 var root = (tag || GALLERY_VERSION) + BUILD, |
|
4696 base = (config && config.base) ? config.base : CDN_BASE, |
|
4697 combo = (config && config.comboBase) ? config.comboBase : COMBO_BASE; |
|
4698 |
|
4699 groups.gallery.base = base + root; |
|
4700 groups.gallery.root = root; |
|
4701 groups.gallery.comboBase = combo; |
|
4702 }; |
|
4703 |
|
4704 |
|
4705 groups[VERSION] = {}; |
|
4706 |
|
4707 groups.gallery = { |
|
4708 ext: false, |
|
4709 combine: true, |
|
4710 comboBase: COMBO_BASE, |
|
4711 update: galleryUpdate, |
|
4712 patterns: { 'gallery-': { }, |
|
4713 'lang/gallery-': {}, |
|
4714 'gallerycss-': { type: 'css' } } |
|
4715 }; |
|
4716 |
|
4717 groups.yui2 = { |
|
4718 combine: true, |
|
4719 ext: false, |
|
4720 comboBase: COMBO_BASE, |
|
4721 update: yui2Update, |
|
4722 patterns: { |
|
4723 'yui2-': { |
|
4724 configFn: function(me) { |
|
4725 if (/-skin|reset|fonts|grids|base/.test(me.name)) { |
|
4726 me.type = 'css'; |
|
4727 me.path = me.path.replace(/\.js/, '.css'); |
|
4728 // this makes skins in builds earlier than |
|
4729 // 2.6.0 work as long as combine is false |
|
4730 me.path = me.path.replace(/\/yui2-skin/, |
|
4731 '/assets/skins/sam/yui2-skin'); |
|
4732 } |
|
4733 } |
|
4734 } |
|
4735 } |
|
4736 }; |
|
4737 |
|
4738 galleryUpdate(); |
|
4739 yui2Update(); |
|
4740 |
|
4741 YUI.Env[VERSION] = META; |
|
4742 }()); |
|
4743 } |
|
4744 |
|
4745 |
|
4746 /*jslint forin: true, maxlen: 350 */ |
|
4747 |
|
4748 /** |
|
4749 * Loader dynamically loads script and css files. It includes the dependency |
|
4750 * information for the version of the library in use, and will automatically pull in |
|
4751 * dependencies for the modules requested. It can also load the |
|
4752 * files from the Yahoo! CDN, and it can utilize the combo service provided on |
|
4753 * this network to reduce the number of http connections required to download |
|
4754 * YUI files. |
|
4755 * |
|
4756 * @module loader |
|
4757 * @main loader |
|
4758 * @submodule loader-base |
|
4759 */ |
|
4760 |
|
4761 var NOT_FOUND = {}, |
|
4762 NO_REQUIREMENTS = [], |
|
4763 MAX_URL_LENGTH = 1024, |
|
4764 GLOBAL_ENV = YUI.Env, |
|
4765 GLOBAL_LOADED = GLOBAL_ENV._loaded, |
|
4766 CSS = 'css', |
|
4767 JS = 'js', |
|
4768 INTL = 'intl', |
|
4769 DEFAULT_SKIN = 'sam', |
|
4770 VERSION = Y.version, |
|
4771 ROOT_LANG = '', |
|
4772 YObject = Y.Object, |
|
4773 oeach = YObject.each, |
|
4774 yArray = Y.Array, |
|
4775 _queue = GLOBAL_ENV._loaderQueue, |
|
4776 META = GLOBAL_ENV[VERSION], |
|
4777 SKIN_PREFIX = 'skin-', |
|
4778 L = Y.Lang, |
|
4779 ON_PAGE = GLOBAL_ENV.mods, |
|
4780 modulekey, |
|
4781 _path = function(dir, file, type, nomin) { |
|
4782 var path = dir + '/' + file; |
|
4783 if (!nomin) { |
|
4784 path += '-min'; |
|
4785 } |
|
4786 path += '.' + (type || CSS); |
|
4787 |
|
4788 return path; |
|
4789 }; |
|
4790 |
|
4791 |
|
4792 if (!YUI.Env._cssLoaded) { |
|
4793 YUI.Env._cssLoaded = {}; |
|
4794 } |
|
4795 |
|
4796 |
|
4797 /** |
|
4798 * The component metadata is stored in Y.Env.meta. |
|
4799 * Part of the loader module. |
|
4800 * @property meta |
|
4801 * @for YUI |
|
4802 */ |
|
4803 Y.Env.meta = META; |
|
4804 |
|
4805 /** |
|
4806 * Loader dynamically loads script and css files. It includes the dependency |
|
4807 * info for the version of the library in use, and will automatically pull in |
|
4808 * dependencies for the modules requested. It can load the |
|
4809 * files from the Yahoo! CDN, and it can utilize the combo service provided on |
|
4810 * this network to reduce the number of http connections required to download |
|
4811 * YUI files. You can also specify an external, custom combo service to host |
|
4812 * your modules as well. |
|
4813 |
|
4814 var Y = YUI(); |
|
4815 var loader = new Y.Loader({ |
|
4816 filter: 'debug', |
|
4817 base: '../../', |
|
4818 root: 'build/', |
|
4819 combine: true, |
|
4820 require: ['node', 'dd', 'console'] |
|
4821 }); |
|
4822 var out = loader.resolve(true); |
|
4823 |
|
4824 * @constructor |
|
4825 * @class Loader |
|
4826 * @param {Object} config an optional set of configuration options. |
|
4827 * @param {String} config.base The base dir which to fetch this module from |
|
4828 * @param {String} config.comboBase The Combo service base path. Ex: `http://yui.yahooapis.com/combo?` |
|
4829 * @param {String} config.root The root path to prepend to module names for the combo service. Ex: `2.5.2/build/` |
|
4830 * @param {String|Object} config.filter A filter to apply to result urls. <a href="#property_filter">See filter property</a> |
|
4831 * @param {Object} config.filters Per-component filter specification. If specified for a given component, this overrides the filter config. |
|
4832 * @param {Boolean} config.combine Use a combo service to reduce the number of http connections required to load your dependencies |
|
4833 * @param {Boolean} [config.async=true] Fetch files in async |
|
4834 * @param {Array} config.ignore: A list of modules that should never be dynamically loaded |
|
4835 * @param {Array} config.force A list of modules that should always be loaded when required, even if already present on the page |
|
4836 * @param {HTMLElement|String} config.insertBefore Node or id for a node that should be used as the insertion point for new nodes |
|
4837 * @param {Object} config.jsAttributes Object literal containing attributes to add to script nodes |
|
4838 * @param {Object} config.cssAttributes Object literal containing attributes to add to link nodes |
|
4839 * @param {Number} config.timeout The number of milliseconds before a timeout occurs when dynamically loading nodes. If not set, there is no timeout |
|
4840 * @param {Object} config.context Execution context for all callbacks |
|
4841 * @param {Function} config.onSuccess Callback for the 'success' event |
|
4842 * @param {Function} config.onFailure Callback for the 'failure' event |
|
4843 * @param {Function} config.onCSS Callback for the 'CSSComplete' event. When loading YUI components with CSS the CSS is loaded first, then the script. This provides a moment you can tie into to improve the presentation of the page while the script is loading. |
|
4844 * @param {Function} config.onTimeout Callback for the 'timeout' event |
|
4845 * @param {Function} config.onProgress Callback executed each time a script or css file is loaded |
|
4846 * @param {Object} config.modules A list of module definitions. See <a href="#method_addModule">Loader.addModule</a> for the supported module metadata |
|
4847 * @param {Object} config.groups A list of group definitions. Each group can contain specific definitions for `base`, `comboBase`, `combine`, and accepts a list of `modules`. |
|
4848 * @param {String} config.2in3 The version of the YUI 2 in 3 wrapper to use. The intrinsic support for YUI 2 modules in YUI 3 relies on versions of the YUI 2 components inside YUI 3 module wrappers. These wrappers change over time to accomodate the issues that arise from running YUI 2 in a YUI 3 sandbox. |
|
4849 * @param {String} config.yui2 When using the 2in3 project, you can select the version of YUI 2 to use. Valid values are `2.2.2`, `2.3.1`, `2.4.1`, `2.5.2`, `2.6.0`, `2.7.0`, `2.8.0`, `2.8.1` and `2.9.0` [default] -- plus all versions of YUI 2 going forward. |
|
4850 */ |
|
4851 Y.Loader = function(o) { |
|
4852 |
|
4853 var self = this; |
|
4854 |
|
4855 //Catch no config passed. |
|
4856 o = o || {}; |
|
4857 |
|
4858 modulekey = META.md5; |
|
4859 |
|
4860 /** |
|
4861 * Internal callback to handle multiple internal insert() calls |
|
4862 * so that css is inserted prior to js |
|
4863 * @property _internalCallback |
|
4864 * @private |
|
4865 */ |
|
4866 // self._internalCallback = null; |
|
4867 |
|
4868 /** |
|
4869 * Callback that will be executed when the loader is finished |
|
4870 * with an insert |
|
4871 * @method onSuccess |
|
4872 * @type function |
|
4873 */ |
|
4874 // self.onSuccess = null; |
|
4875 |
|
4876 /** |
|
4877 * Callback that will be executed if there is a failure |
|
4878 * @method onFailure |
|
4879 * @type function |
|
4880 */ |
|
4881 // self.onFailure = null; |
|
4882 |
|
4883 /** |
|
4884 * Callback for the 'CSSComplete' event. When loading YUI components |
|
4885 * with CSS the CSS is loaded first, then the script. This provides |
|
4886 * a moment you can tie into to improve the presentation of the page |
|
4887 * while the script is loading. |
|
4888 * @method onCSS |
|
4889 * @type function |
|
4890 */ |
|
4891 // self.onCSS = null; |
|
4892 |
|
4893 /** |
|
4894 * Callback executed each time a script or css file is loaded |
|
4895 * @method onProgress |
|
4896 * @type function |
|
4897 */ |
|
4898 // self.onProgress = null; |
|
4899 |
|
4900 /** |
|
4901 * Callback that will be executed if a timeout occurs |
|
4902 * @method onTimeout |
|
4903 * @type function |
|
4904 */ |
|
4905 // self.onTimeout = null; |
|
4906 |
|
4907 /** |
|
4908 * The execution context for all callbacks |
|
4909 * @property context |
|
4910 * @default {YUI} the YUI instance |
|
4911 */ |
|
4912 self.context = Y; |
|
4913 |
|
4914 /** |
|
4915 * Data that is passed to all callbacks |
|
4916 * @property data |
|
4917 */ |
|
4918 // self.data = null; |
|
4919 |
|
4920 /** |
|
4921 * Node reference or id where new nodes should be inserted before |
|
4922 * @property insertBefore |
|
4923 * @type string|HTMLElement |
|
4924 */ |
|
4925 // self.insertBefore = null; |
|
4926 |
|
4927 /** |
|
4928 * The charset attribute for inserted nodes |
|
4929 * @property charset |
|
4930 * @type string |
|
4931 * @deprecated , use cssAttributes or jsAttributes. |
|
4932 */ |
|
4933 // self.charset = null; |
|
4934 |
|
4935 /** |
|
4936 * An object literal containing attributes to add to link nodes |
|
4937 * @property cssAttributes |
|
4938 * @type object |
|
4939 */ |
|
4940 // self.cssAttributes = null; |
|
4941 |
|
4942 /** |
|
4943 * An object literal containing attributes to add to script nodes |
|
4944 * @property jsAttributes |
|
4945 * @type object |
|
4946 */ |
|
4947 // self.jsAttributes = null; |
|
4948 |
|
4949 /** |
|
4950 * The base directory. |
|
4951 * @property base |
|
4952 * @type string |
|
4953 * @default http://yui.yahooapis.com/[YUI VERSION]/build/ |
|
4954 */ |
|
4955 self.base = Y.Env.meta.base + Y.Env.meta.root; |
|
4956 |
|
4957 /** |
|
4958 * Base path for the combo service |
|
4959 * @property comboBase |
|
4960 * @type string |
|
4961 * @default http://yui.yahooapis.com/combo? |
|
4962 */ |
|
4963 self.comboBase = Y.Env.meta.comboBase; |
|
4964 |
|
4965 /* |
|
4966 * Base path for language packs. |
|
4967 */ |
|
4968 // self.langBase = Y.Env.meta.langBase; |
|
4969 // self.lang = ""; |
|
4970 |
|
4971 /** |
|
4972 * If configured, the loader will attempt to use the combo |
|
4973 * service for YUI resources and configured external resources. |
|
4974 * @property combine |
|
4975 * @type boolean |
|
4976 * @default true if a base dir isn't in the config |
|
4977 */ |
|
4978 self.combine = o.base && |
|
4979 (o.base.indexOf(self.comboBase.substr(0, 20)) > -1); |
|
4980 |
|
4981 /** |
|
4982 * The default seperator to use between files in a combo URL |
|
4983 * @property comboSep |
|
4984 * @type {String} |
|
4985 * @default Ampersand |
|
4986 */ |
|
4987 self.comboSep = '&'; |
|
4988 /** |
|
4989 * Max url length for combo urls. The default is 1024. This is the URL |
|
4990 * limit for the Yahoo! hosted combo servers. If consuming |
|
4991 * a different combo service that has a different URL limit |
|
4992 * it is possible to override this default by supplying |
|
4993 * the maxURLLength config option. The config option will |
|
4994 * only take effect if lower than the default. |
|
4995 * |
|
4996 * @property maxURLLength |
|
4997 * @type int |
|
4998 */ |
|
4999 self.maxURLLength = MAX_URL_LENGTH; |
|
5000 |
|
5001 /** |
|
5002 * Ignore modules registered on the YUI global |
|
5003 * @property ignoreRegistered |
|
5004 * @default false |
|
5005 */ |
|
5006 self.ignoreRegistered = o.ignoreRegistered; |
|
5007 |
|
5008 /** |
|
5009 * Root path to prepend to module path for the combo |
|
5010 * service |
|
5011 * @property root |
|
5012 * @type string |
|
5013 * @default [YUI VERSION]/build/ |
|
5014 */ |
|
5015 self.root = Y.Env.meta.root; |
|
5016 |
|
5017 /** |
|
5018 * Timeout value in milliseconds. If set, self value will be used by |
|
5019 * the get utility. the timeout event will fire if |
|
5020 * a timeout occurs. |
|
5021 * @property timeout |
|
5022 * @type int |
|
5023 */ |
|
5024 self.timeout = 0; |
|
5025 |
|
5026 /** |
|
5027 * A list of modules that should not be loaded, even if |
|
5028 * they turn up in the dependency tree |
|
5029 * @property ignore |
|
5030 * @type string[] |
|
5031 */ |
|
5032 // self.ignore = null; |
|
5033 |
|
5034 /** |
|
5035 * A list of modules that should always be loaded, even |
|
5036 * if they have already been inserted into the page. |
|
5037 * @property force |
|
5038 * @type string[] |
|
5039 */ |
|
5040 // self.force = null; |
|
5041 |
|
5042 self.forceMap = {}; |
|
5043 |
|
5044 /** |
|
5045 * Should we allow rollups |
|
5046 * @property allowRollup |
|
5047 * @type boolean |
|
5048 * @default false |
|
5049 */ |
|
5050 self.allowRollup = false; |
|
5051 |
|
5052 /** |
|
5053 * A filter to apply to result urls. This filter will modify the default |
|
5054 * path for all modules. The default path for the YUI library is the |
|
5055 * minified version of the files (e.g., event-min.js). The filter property |
|
5056 * can be a predefined filter or a custom filter. The valid predefined |
|
5057 * filters are: |
|
5058 * <dl> |
|
5059 * <dt>DEBUG</dt> |
|
5060 * <dd>Selects the debug versions of the library (e.g., event-debug.js). |
|
5061 * This option will automatically include the Logger widget</dd> |
|
5062 * <dt>RAW</dt> |
|
5063 * <dd>Selects the non-minified version of the library (e.g., event.js). |
|
5064 * </dd> |
|
5065 * </dl> |
|
5066 * You can also define a custom filter, which must be an object literal |
|
5067 * containing a search expression and a replace string: |
|
5068 * |
|
5069 * myFilter: { |
|
5070 * 'searchExp': "-min\\.js", |
|
5071 * 'replaceStr': "-debug.js" |
|
5072 * } |
|
5073 * |
|
5074 * @property filter |
|
5075 * @type string| {searchExp: string, replaceStr: string} |
|
5076 */ |
|
5077 // self.filter = null; |
|
5078 |
|
5079 /** |
|
5080 * per-component filter specification. If specified for a given |
|
5081 * component, this overrides the filter config. |
|
5082 * @property filters |
|
5083 * @type object |
|
5084 */ |
|
5085 self.filters = {}; |
|
5086 |
|
5087 /** |
|
5088 * The list of requested modules |
|
5089 * @property required |
|
5090 * @type {string: boolean} |
|
5091 */ |
|
5092 self.required = {}; |
|
5093 |
|
5094 /** |
|
5095 * If a module name is predefined when requested, it is checked againsts |
|
5096 * the patterns provided in this property. If there is a match, the |
|
5097 * module is added with the default configuration. |
|
5098 * |
|
5099 * At the moment only supporting module prefixes, but anticipate |
|
5100 * supporting at least regular expressions. |
|
5101 * @property patterns |
|
5102 * @type Object |
|
5103 */ |
|
5104 // self.patterns = Y.merge(Y.Env.meta.patterns); |
|
5105 self.patterns = {}; |
|
5106 |
|
5107 /** |
|
5108 * The library metadata |
|
5109 * @property moduleInfo |
|
5110 */ |
|
5111 // self.moduleInfo = Y.merge(Y.Env.meta.moduleInfo); |
|
5112 self.moduleInfo = {}; |
|
5113 |
|
5114 self.groups = Y.merge(Y.Env.meta.groups); |
|
5115 |
|
5116 /** |
|
5117 * Provides the information used to skin the skinnable components. |
|
5118 * The following skin definition would result in 'skin1' and 'skin2' |
|
5119 * being loaded for calendar (if calendar was requested), and |
|
5120 * 'sam' for all other skinnable components: |
|
5121 * |
|
5122 * skin: { |
|
5123 * // The default skin, which is automatically applied if not |
|
5124 * // overriden by a component-specific skin definition. |
|
5125 * // Change this in to apply a different skin globally |
|
5126 * defaultSkin: 'sam', |
|
5127 * |
|
5128 * // This is combined with the loader base property to get |
|
5129 * // the default root directory for a skin. ex: |
|
5130 * // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/ |
|
5131 * base: 'assets/skins/', |
|
5132 * |
|
5133 * // Any component-specific overrides can be specified here, |
|
5134 * // making it possible to load different skins for different |
|
5135 * // components. It is possible to load more than one skin |
|
5136 * // for a given component as well. |
|
5137 * overrides: { |
|
5138 * calendar: ['skin1', 'skin2'] |
|
5139 * } |
|
5140 * } |
|
5141 * @property skin |
|
5142 * @type {Object} |
|
5143 */ |
|
5144 self.skin = Y.merge(Y.Env.meta.skin); |
|
5145 |
|
5146 /* |
|
5147 * Map of conditional modules |
|
5148 * @since 3.2.0 |
|
5149 */ |
|
5150 self.conditions = {}; |
|
5151 |
|
5152 // map of modules with a hash of modules that meet the requirement |
|
5153 // self.provides = {}; |
|
5154 |
|
5155 self.config = o; |
|
5156 self._internal = true; |
|
5157 |
|
5158 self._populateCache(); |
|
5159 |
|
5160 /** |
|
5161 * Set when beginning to compute the dependency tree. |
|
5162 * Composed of what YUI reports to be loaded combined |
|
5163 * with what has been loaded by any instance on the page |
|
5164 * with the version number specified in the metadata. |
|
5165 * @property loaded |
|
5166 * @type {string: boolean} |
|
5167 */ |
|
5168 self.loaded = GLOBAL_LOADED[VERSION]; |
|
5169 |
|
5170 |
|
5171 /** |
|
5172 * Should Loader fetch scripts in `async`, defaults to `true` |
|
5173 * @property async |
|
5174 */ |
|
5175 |
|
5176 self.async = true; |
|
5177 |
|
5178 self._inspectPage(); |
|
5179 |
|
5180 self._internal = false; |
|
5181 |
|
5182 self._config(o); |
|
5183 |
|
5184 self.forceMap = (self.force) ? Y.Array.hash(self.force) : {}; |
|
5185 |
|
5186 self.testresults = null; |
|
5187 |
|
5188 if (Y.config.tests) { |
|
5189 self.testresults = Y.config.tests; |
|
5190 } |
|
5191 |
|
5192 /** |
|
5193 * List of rollup files found in the library metadata |
|
5194 * @property rollups |
|
5195 */ |
|
5196 // self.rollups = null; |
|
5197 |
|
5198 /** |
|
5199 * Whether or not to load optional dependencies for |
|
5200 * the requested modules |
|
5201 * @property loadOptional |
|
5202 * @type boolean |
|
5203 * @default false |
|
5204 */ |
|
5205 // self.loadOptional = false; |
|
5206 |
|
5207 /** |
|
5208 * All of the derived dependencies in sorted order, which |
|
5209 * will be populated when either calculate() or insert() |
|
5210 * is called |
|
5211 * @property sorted |
|
5212 * @type string[] |
|
5213 */ |
|
5214 self.sorted = []; |
|
5215 |
|
5216 /* |
|
5217 * A list of modules to attach to the YUI instance when complete. |
|
5218 * If not supplied, the sorted list of dependencies are applied. |
|
5219 * @property attaching |
|
5220 */ |
|
5221 // self.attaching = null; |
|
5222 |
|
5223 /** |
|
5224 * Flag to indicate the dependency tree needs to be recomputed |
|
5225 * if insert is called again. |
|
5226 * @property dirty |
|
5227 * @type boolean |
|
5228 * @default true |
|
5229 */ |
|
5230 self.dirty = true; |
|
5231 |
|
5232 /** |
|
5233 * List of modules inserted by the utility |
|
5234 * @property inserted |
|
5235 * @type {string: boolean} |
|
5236 */ |
|
5237 self.inserted = {}; |
|
5238 |
|
5239 /** |
|
5240 * List of skipped modules during insert() because the module |
|
5241 * was not defined |
|
5242 * @property skipped |
|
5243 */ |
|
5244 self.skipped = {}; |
|
5245 |
|
5246 // Y.on('yui:load', self.loadNext, self); |
|
5247 |
|
5248 self.tested = {}; |
|
5249 |
|
5250 /* |
|
5251 * Cached sorted calculate results |
|
5252 * @property results |
|
5253 * @since 3.2.0 |
|
5254 */ |
|
5255 //self.results = {}; |
|
5256 |
|
5257 if (self.ignoreRegistered) { |
|
5258 //Clear inpage already processed modules. |
|
5259 self._resetModules(); |
|
5260 } |
|
5261 |
|
5262 }; |
|
5263 |
|
5264 Y.Loader.prototype = { |
|
5265 /** |
|
5266 * Checks the cache for modules and conditions, if they do not exist |
|
5267 * process the default metadata and populate the local moduleInfo hash. |
|
5268 * @method _populateCache |
|
5269 * @private |
|
5270 */ |
|
5271 _populateCache: function() { |
|
5272 var self = this, |
|
5273 defaults = META.modules, |
|
5274 cache = GLOBAL_ENV._renderedMods, |
|
5275 i; |
|
5276 |
|
5277 if (cache && !self.ignoreRegistered) { |
|
5278 for (i in cache) { |
|
5279 if (cache.hasOwnProperty(i)) { |
|
5280 self.moduleInfo[i] = Y.merge(cache[i]); |
|
5281 } |
|
5282 } |
|
5283 |
|
5284 cache = GLOBAL_ENV._conditions; |
|
5285 for (i in cache) { |
|
5286 if (cache.hasOwnProperty(i)) { |
|
5287 self.conditions[i] = Y.merge(cache[i]); |
|
5288 } |
|
5289 } |
|
5290 |
|
5291 } else { |
|
5292 for (i in defaults) { |
|
5293 if (defaults.hasOwnProperty(i)) { |
|
5294 self.addModule(defaults[i], i); |
|
5295 } |
|
5296 } |
|
5297 } |
|
5298 |
|
5299 }, |
|
5300 /** |
|
5301 * Reset modules in the module cache to a pre-processed state so additional |
|
5302 * computations with a different skin or language will work as expected. |
|
5303 * @method _resetModules |
|
5304 * @private |
|
5305 */ |
|
5306 _resetModules: function() { |
|
5307 var self = this, i, o, |
|
5308 mod, name, details; |
|
5309 for (i in self.moduleInfo) { |
|
5310 if (self.moduleInfo.hasOwnProperty(i)) { |
|
5311 mod = self.moduleInfo[i]; |
|
5312 name = mod.name; |
|
5313 details = (YUI.Env.mods[name] ? YUI.Env.mods[name].details : null); |
|
5314 |
|
5315 if (details) { |
|
5316 self.moduleInfo[name]._reset = true; |
|
5317 self.moduleInfo[name].requires = details.requires || []; |
|
5318 self.moduleInfo[name].optional = details.optional || []; |
|
5319 self.moduleInfo[name].supersedes = details.supercedes || []; |
|
5320 } |
|
5321 |
|
5322 if (mod.defaults) { |
|
5323 for (o in mod.defaults) { |
|
5324 if (mod.defaults.hasOwnProperty(o)) { |
|
5325 if (mod[o]) { |
|
5326 mod[o] = mod.defaults[o]; |
|
5327 } |
|
5328 } |
|
5329 } |
|
5330 } |
|
5331 delete mod.langCache; |
|
5332 delete mod.skinCache; |
|
5333 if (mod.skinnable) { |
|
5334 self._addSkin(self.skin.defaultSkin, mod.name); |
|
5335 } |
|
5336 } |
|
5337 } |
|
5338 }, |
|
5339 /** |
|
5340 Regex that matches a CSS URL. Used to guess the file type when it's not |
|
5341 specified. |
|
5342 |
|
5343 @property REGEX_CSS |
|
5344 @type RegExp |
|
5345 @final |
|
5346 @protected |
|
5347 @since 3.5.0 |
|
5348 **/ |
|
5349 REGEX_CSS: /\.css(?:[?;].*)?$/i, |
|
5350 |
|
5351 /** |
|
5352 * Default filters for raw and debug |
|
5353 * @property FILTER_DEFS |
|
5354 * @type Object |
|
5355 * @final |
|
5356 * @protected |
|
5357 */ |
|
5358 FILTER_DEFS: { |
|
5359 RAW: { |
|
5360 'searchExp': '-min\\.js', |
|
5361 'replaceStr': '.js' |
|
5362 }, |
|
5363 DEBUG: { |
|
5364 'searchExp': '-min\\.js', |
|
5365 'replaceStr': '-debug.js' |
|
5366 }, |
|
5367 COVERAGE: { |
|
5368 'searchExp': '-min\\.js', |
|
5369 'replaceStr': '-coverage.js' |
|
5370 } |
|
5371 }, |
|
5372 /* |
|
5373 * Check the pages meta-data and cache the result. |
|
5374 * @method _inspectPage |
|
5375 * @private |
|
5376 */ |
|
5377 _inspectPage: function() { |
|
5378 var self = this, v, m, req, mr, i; |
|
5379 |
|
5380 //Inspect the page for CSS only modules and mark them as loaded. |
|
5381 for (i in self.moduleInfo) { |
|
5382 if (self.moduleInfo.hasOwnProperty(i)) { |
|
5383 v = self.moduleInfo[i]; |
|
5384 if (v.type && v.type === CSS) { |
|
5385 if (self.isCSSLoaded(v.name)) { |
|
5386 self.loaded[i] = true; |
|
5387 } |
|
5388 } |
|
5389 } |
|
5390 } |
|
5391 for (i in ON_PAGE) { |
|
5392 if (ON_PAGE.hasOwnProperty(i)) { |
|
5393 v = ON_PAGE[i]; |
|
5394 if (v.details) { |
|
5395 m = self.moduleInfo[v.name]; |
|
5396 req = v.details.requires; |
|
5397 mr = m && m.requires; |
|
5398 |
|
5399 if (m) { |
|
5400 if (!m._inspected && req && mr.length !== req.length) { |
|
5401 // console.log('deleting ' + m.name); |
|
5402 delete m.expanded; |
|
5403 } |
|
5404 } else { |
|
5405 m = self.addModule(v.details, i); |
|
5406 } |
|
5407 m._inspected = true; |
|
5408 } |
|
5409 } |
|
5410 } |
|
5411 }, |
|
5412 /* |
|
5413 * returns true if b is not loaded, and is required directly or by means of modules it supersedes. |
|
5414 * @private |
|
5415 * @method _requires |
|
5416 * @param {String} mod1 The first module to compare |
|
5417 * @param {String} mod2 The second module to compare |
|
5418 */ |
|
5419 _requires: function(mod1, mod2) { |
|
5420 |
|
5421 var i, rm, after_map, s, |
|
5422 info = this.moduleInfo, |
|
5423 m = info[mod1], |
|
5424 other = info[mod2]; |
|
5425 |
|
5426 if (!m || !other) { |
|
5427 return false; |
|
5428 } |
|
5429 |
|
5430 rm = m.expanded_map; |
|
5431 after_map = m.after_map; |
|
5432 |
|
5433 // check if this module should be sorted after the other |
|
5434 // do this first to short circut circular deps |
|
5435 if (after_map && (mod2 in after_map)) { |
|
5436 return true; |
|
5437 } |
|
5438 |
|
5439 after_map = other.after_map; |
|
5440 |
|
5441 // and vis-versa |
|
5442 if (after_map && (mod1 in after_map)) { |
|
5443 return false; |
|
5444 } |
|
5445 |
|
5446 // check if this module requires one the other supersedes |
|
5447 s = info[mod2] && info[mod2].supersedes; |
|
5448 if (s) { |
|
5449 for (i = 0; i < s.length; i++) { |
|
5450 if (this._requires(mod1, s[i])) { |
|
5451 return true; |
|
5452 } |
|
5453 } |
|
5454 } |
|
5455 |
|
5456 s = info[mod1] && info[mod1].supersedes; |
|
5457 if (s) { |
|
5458 for (i = 0; i < s.length; i++) { |
|
5459 if (this._requires(mod2, s[i])) { |
|
5460 return false; |
|
5461 } |
|
5462 } |
|
5463 } |
|
5464 |
|
5465 // check if this module requires the other directly |
|
5466 // if (r && yArray.indexOf(r, mod2) > -1) { |
|
5467 if (rm && (mod2 in rm)) { |
|
5468 return true; |
|
5469 } |
|
5470 |
|
5471 // external css files should be sorted below yui css |
|
5472 if (m.ext && m.type === CSS && !other.ext && other.type === CSS) { |
|
5473 return true; |
|
5474 } |
|
5475 |
|
5476 return false; |
|
5477 }, |
|
5478 /** |
|
5479 * Apply a new config to the Loader instance |
|
5480 * @method _config |
|
5481 * @private |
|
5482 * @param {Object} o The new configuration |
|
5483 */ |
|
5484 _config: function(o) { |
|
5485 var i, j, val, a, f, group, groupName, self = this, |
|
5486 mods = [], mod; |
|
5487 // apply config values |
|
5488 if (o) { |
|
5489 for (i in o) { |
|
5490 if (o.hasOwnProperty(i)) { |
|
5491 val = o[i]; |
|
5492 //TODO This should be a case |
|
5493 if (i === 'require') { |
|
5494 self.require(val); |
|
5495 } else if (i === 'skin') { |
|
5496 //If the config.skin is a string, format to the expected object |
|
5497 if (typeof val === 'string') { |
|
5498 self.skin.defaultSkin = o.skin; |
|
5499 val = { |
|
5500 defaultSkin: val |
|
5501 }; |
|
5502 } |
|
5503 |
|
5504 Y.mix(self.skin, val, true); |
|
5505 } else if (i === 'groups') { |
|
5506 for (j in val) { |
|
5507 if (val.hasOwnProperty(j)) { |
|
5508 groupName = j; |
|
5509 group = val[j]; |
|
5510 self.addGroup(group, groupName); |
|
5511 if (group.aliases) { |
|
5512 for (a in group.aliases) { |
|
5513 if (group.aliases.hasOwnProperty(a)) { |
|
5514 self.addAlias(group.aliases[a], a); |
|
5515 } |
|
5516 } |
|
5517 } |
|
5518 } |
|
5519 } |
|
5520 |
|
5521 } else if (i === 'modules') { |
|
5522 // add a hash of module definitions |
|
5523 for (j in val) { |
|
5524 if (val.hasOwnProperty(j)) { |
|
5525 self.addModule(val[j], j); |
|
5526 } |
|
5527 } |
|
5528 } else if (i === 'aliases') { |
|
5529 for (j in val) { |
|
5530 if (val.hasOwnProperty(j)) { |
|
5531 self.addAlias(val[j], j); |
|
5532 } |
|
5533 } |
|
5534 } else if (i === 'gallery') { |
|
5535 if (this.groups.gallery.update) { |
|
5536 this.groups.gallery.update(val, o); |
|
5537 } |
|
5538 } else if (i === 'yui2' || i === '2in3') { |
|
5539 if (this.groups.yui2.update) { |
|
5540 this.groups.yui2.update(o['2in3'], o.yui2, o); |
|
5541 } |
|
5542 } else { |
|
5543 self[i] = val; |
|
5544 } |
|
5545 } |
|
5546 } |
|
5547 } |
|
5548 |
|
5549 // fix filter |
|
5550 f = self.filter; |
|
5551 |
|
5552 if (L.isString(f)) { |
|
5553 f = f.toUpperCase(); |
|
5554 self.filterName = f; |
|
5555 self.filter = self.FILTER_DEFS[f]; |
|
5556 if (f === 'DEBUG') { |
|
5557 self.require('yui-log', 'dump'); |
|
5558 } |
|
5559 } |
|
5560 |
|
5561 if (self.filterName && self.coverage) { |
|
5562 if (self.filterName === 'COVERAGE' && L.isArray(self.coverage) && self.coverage.length) { |
|
5563 for (i = 0; i < self.coverage.length; i++) { |
|
5564 mod = self.coverage[i]; |
|
5565 if (self.moduleInfo[mod] && self.moduleInfo[mod].use) { |
|
5566 mods = [].concat(mods, self.moduleInfo[mod].use); |
|
5567 } else { |
|
5568 mods.push(mod); |
|
5569 } |
|
5570 } |
|
5571 self.filters = self.filters || {}; |
|
5572 Y.Array.each(mods, function(mod) { |
|
5573 self.filters[mod] = self.FILTER_DEFS.COVERAGE; |
|
5574 }); |
|
5575 self.filterName = 'RAW'; |
|
5576 self.filter = self.FILTER_DEFS[self.filterName]; |
|
5577 } |
|
5578 } |
|
5579 |
|
5580 }, |
|
5581 |
|
5582 /** |
|
5583 * Returns the skin module name for the specified skin name. If a |
|
5584 * module name is supplied, the returned skin module name is |
|
5585 * specific to the module passed in. |
|
5586 * @method formatSkin |
|
5587 * @param {string} skin the name of the skin. |
|
5588 * @param {string} mod optional: the name of a module to skin. |
|
5589 * @return {string} the full skin module name. |
|
5590 */ |
|
5591 formatSkin: function(skin, mod) { |
|
5592 var s = SKIN_PREFIX + skin; |
|
5593 if (mod) { |
|
5594 s = s + '-' + mod; |
|
5595 } |
|
5596 |
|
5597 return s; |
|
5598 }, |
|
5599 |
|
5600 /** |
|
5601 * Adds the skin def to the module info |
|
5602 * @method _addSkin |
|
5603 * @param {string} skin the name of the skin. |
|
5604 * @param {string} mod the name of the module. |
|
5605 * @param {string} parent parent module if this is a skin of a |
|
5606 * submodule or plugin. |
|
5607 * @return {string} the module name for the skin. |
|
5608 * @private |
|
5609 */ |
|
5610 _addSkin: function(skin, mod, parent) { |
|
5611 var mdef, pkg, name, nmod, |
|
5612 info = this.moduleInfo, |
|
5613 sinf = this.skin, |
|
5614 ext = info[mod] && info[mod].ext; |
|
5615 |
|
5616 // Add a module definition for the module-specific skin css |
|
5617 if (mod) { |
|
5618 name = this.formatSkin(skin, mod); |
|
5619 if (!info[name]) { |
|
5620 mdef = info[mod]; |
|
5621 pkg = mdef.pkg || mod; |
|
5622 nmod = { |
|
5623 skin: true, |
|
5624 name: name, |
|
5625 group: mdef.group, |
|
5626 type: 'css', |
|
5627 after: sinf.after, |
|
5628 path: (parent || pkg) + '/' + sinf.base + skin + |
|
5629 '/' + mod + '.css', |
|
5630 ext: ext |
|
5631 }; |
|
5632 if (mdef.base) { |
|
5633 nmod.base = mdef.base; |
|
5634 } |
|
5635 if (mdef.configFn) { |
|
5636 nmod.configFn = mdef.configFn; |
|
5637 } |
|
5638 this.addModule(nmod, name); |
|
5639 |
|
5640 } |
|
5641 } |
|
5642 |
|
5643 return name; |
|
5644 }, |
|
5645 /** |
|
5646 * Adds an alias module to the system |
|
5647 * @method addAlias |
|
5648 * @param {Array} use An array of modules that makes up this alias |
|
5649 * @param {String} name The name of the alias |
|
5650 * @example |
|
5651 * var loader = new Y.Loader({}); |
|
5652 * loader.addAlias([ 'node', 'yql' ], 'davglass'); |
|
5653 * loader.require(['davglass']); |
|
5654 * var out = loader.resolve(true); |
|
5655 * |
|
5656 * //out.js will contain Node and YQL modules |
|
5657 */ |
|
5658 addAlias: function(use, name) { |
|
5659 YUI.Env.aliases[name] = use; |
|
5660 this.addModule({ |
|
5661 name: name, |
|
5662 use: use |
|
5663 }); |
|
5664 }, |
|
5665 /** |
|
5666 * Add a new module group |
|
5667 * @method addGroup |
|
5668 * @param {Object} config An object containing the group configuration data |
|
5669 * @param {String} config.name required, the group name |
|
5670 * @param {String} config.base The base directory for this module group |
|
5671 * @param {String} config.root The root path to add to each combo resource path |
|
5672 * @param {Boolean} config.combine Should the request be combined |
|
5673 * @param {String} config.comboBase Combo service base path |
|
5674 * @param {Object} config.modules The group of modules |
|
5675 * @param {String} name the group name. |
|
5676 * @example |
|
5677 * var loader = new Y.Loader({}); |
|
5678 * loader.addGroup({ |
|
5679 * name: 'davglass', |
|
5680 * combine: true, |
|
5681 * comboBase: '/combo?', |
|
5682 * root: '', |
|
5683 * modules: { |
|
5684 * //Module List here |
|
5685 * } |
|
5686 * }, 'davglass'); |
|
5687 */ |
|
5688 addGroup: function(o, name) { |
|
5689 var mods = o.modules, |
|
5690 self = this, i, v; |
|
5691 |
|
5692 name = name || o.name; |
|
5693 o.name = name; |
|
5694 self.groups[name] = o; |
|
5695 |
|
5696 if (o.patterns) { |
|
5697 for (i in o.patterns) { |
|
5698 if (o.patterns.hasOwnProperty(i)) { |
|
5699 o.patterns[i].group = name; |
|
5700 self.patterns[i] = o.patterns[i]; |
|
5701 } |
|
5702 } |
|
5703 } |
|
5704 |
|
5705 if (mods) { |
|
5706 for (i in mods) { |
|
5707 if (mods.hasOwnProperty(i)) { |
|
5708 v = mods[i]; |
|
5709 if (typeof v === 'string') { |
|
5710 v = { name: i, fullpath: v }; |
|
5711 } |
|
5712 v.group = name; |
|
5713 self.addModule(v, i); |
|
5714 } |
|
5715 } |
|
5716 } |
|
5717 }, |
|
5718 |
|
5719 /** |
|
5720 * Add a new module to the component metadata. |
|
5721 * @method addModule |
|
5722 * @param {Object} config An object containing the module data. |
|
5723 * @param {String} config.name Required, the component name |
|
5724 * @param {String} config.type Required, the component type (js or css) |
|
5725 * @param {String} config.path Required, the path to the script from `base` |
|
5726 * @param {Array} config.requires Array of modules required by this component |
|
5727 * @param {Array} [config.optional] Array of optional modules for this component |
|
5728 * @param {Array} [config.supersedes] Array of the modules this component replaces |
|
5729 * @param {Array} [config.after] Array of modules the components which, if present, should be sorted above this one |
|
5730 * @param {Object} [config.after_map] Faster alternative to 'after' -- supply a hash instead of an array |
|
5731 * @param {Number} [config.rollup] The number of superseded modules required for automatic rollup |
|
5732 * @param {String} [config.fullpath] If `fullpath` is specified, this is used instead of the configured `base + path` |
|
5733 * @param {Boolean} [config.skinnable] Flag to determine if skin assets should automatically be pulled in |
|
5734 * @param {Object} [config.submodules] Hash of submodules |
|
5735 * @param {String} [config.group] The group the module belongs to -- this is set automatically when it is added as part of a group configuration. |
|
5736 * @param {Array} [config.lang] Array of BCP 47 language tags of languages for which this module has localized resource bundles, e.g., `["en-GB", "zh-Hans-CN"]` |
|
5737 * @param {Object} [config.condition] Specifies that the module should be loaded automatically if a condition is met. This is an object with up to four fields: |
|
5738 * @param {String} [config.condition.trigger] The name of a module that can trigger the auto-load |
|
5739 * @param {Function} [config.condition.test] A function that returns true when the module is to be loaded. |
|
5740 * @param {String} [config.condition.ua] The UA name of <a href="UA.html">Y.UA</a> object that returns true when the module is to be loaded. e.g., `"ie"`, `"nodejs"`. |
|
5741 * @param {String} [config.condition.when] Specifies the load order of the conditional module |
|
5742 * with regard to the position of the trigger module. |
|
5743 * This should be one of three values: `before`, `after`, or `instead`. The default is `after`. |
|
5744 * @param {Object} [config.testresults] A hash of test results from `Y.Features.all()` |
|
5745 * @param {Function} [config.configFn] A function to exectute when configuring this module |
|
5746 * @param {Object} config.configFn.mod The module config, modifying this object will modify it's config. Returning false will delete the module's config. |
|
5747 * @param {String} [name] The module name, required if not in the module data. |
|
5748 * @return {Object} the module definition or null if the object passed in did not provide all required attributes. |
|
5749 */ |
|
5750 addModule: function(o, name) { |
|
5751 name = name || o.name; |
|
5752 |
|
5753 if (typeof o === 'string') { |
|
5754 o = { name: name, fullpath: o }; |
|
5755 } |
|
5756 |
|
5757 |
|
5758 var subs, i, l, t, sup, s, smod, plugins, plug, |
|
5759 j, langs, packName, supName, flatSup, flatLang, lang, ret, |
|
5760 overrides, skinname, when, g, p, |
|
5761 conditions = this.conditions, trigger; |
|
5762 |
|
5763 //Only merge this data if the temp flag is set |
|
5764 //from an earlier pass from a pattern or else |
|
5765 //an override module (YUI_config) can not be used to |
|
5766 //replace a default module. |
|
5767 if (this.moduleInfo[name] && this.moduleInfo[name].temp) { |
|
5768 //This catches temp modules loaded via a pattern |
|
5769 // The module will be added twice, once from the pattern and |
|
5770 // Once from the actual add call, this ensures that properties |
|
5771 // that were added to the module the first time around (group: gallery) |
|
5772 // are also added the second time around too. |
|
5773 o = Y.merge(this.moduleInfo[name], o); |
|
5774 } |
|
5775 |
|
5776 o.name = name; |
|
5777 |
|
5778 if (!o || !o.name) { |
|
5779 return null; |
|
5780 } |
|
5781 |
|
5782 if (!o.type) { |
|
5783 //Always assume it's javascript unless the CSS pattern is matched. |
|
5784 o.type = JS; |
|
5785 p = o.path || o.fullpath; |
|
5786 if (p && this.REGEX_CSS.test(p)) { |
|
5787 o.type = CSS; |
|
5788 } |
|
5789 } |
|
5790 |
|
5791 if (!o.path && !o.fullpath) { |
|
5792 o.path = _path(name, name, o.type); |
|
5793 } |
|
5794 o.supersedes = o.supersedes || o.use; |
|
5795 |
|
5796 o.ext = ('ext' in o) ? o.ext : (this._internal) ? false : true; |
|
5797 |
|
5798 // Handle submodule logic |
|
5799 subs = o.submodules; |
|
5800 |
|
5801 this.moduleInfo[name] = o; |
|
5802 |
|
5803 o.requires = o.requires || []; |
|
5804 |
|
5805 /* |
|
5806 Only allowing the cascade of requires information, since |
|
5807 optional and supersedes are far more fine grained than |
|
5808 a blanket requires is. |
|
5809 */ |
|
5810 if (this.requires) { |
|
5811 for (i = 0; i < this.requires.length; i++) { |
|
5812 o.requires.push(this.requires[i]); |
|
5813 } |
|
5814 } |
|
5815 if (o.group && this.groups && this.groups[o.group]) { |
|
5816 g = this.groups[o.group]; |
|
5817 if (g.requires) { |
|
5818 for (i = 0; i < g.requires.length; i++) { |
|
5819 o.requires.push(g.requires[i]); |
|
5820 } |
|
5821 } |
|
5822 } |
|
5823 |
|
5824 |
|
5825 if (!o.defaults) { |
|
5826 o.defaults = { |
|
5827 requires: o.requires ? [].concat(o.requires) : null, |
|
5828 supersedes: o.supersedes ? [].concat(o.supersedes) : null, |
|
5829 optional: o.optional ? [].concat(o.optional) : null |
|
5830 }; |
|
5831 } |
|
5832 |
|
5833 if (o.skinnable && o.ext && o.temp) { |
|
5834 skinname = this._addSkin(this.skin.defaultSkin, name); |
|
5835 o.requires.unshift(skinname); |
|
5836 } |
|
5837 |
|
5838 if (o.requires.length) { |
|
5839 o.requires = this.filterRequires(o.requires) || []; |
|
5840 } |
|
5841 |
|
5842 if (!o.langPack && o.lang) { |
|
5843 langs = yArray(o.lang); |
|
5844 for (j = 0; j < langs.length; j++) { |
|
5845 lang = langs[j]; |
|
5846 packName = this.getLangPackName(lang, name); |
|
5847 smod = this.moduleInfo[packName]; |
|
5848 if (!smod) { |
|
5849 smod = this._addLangPack(lang, o, packName); |
|
5850 } |
|
5851 } |
|
5852 } |
|
5853 |
|
5854 |
|
5855 if (subs) { |
|
5856 sup = o.supersedes || []; |
|
5857 l = 0; |
|
5858 |
|
5859 for (i in subs) { |
|
5860 if (subs.hasOwnProperty(i)) { |
|
5861 s = subs[i]; |
|
5862 |
|
5863 s.path = s.path || _path(name, i, o.type); |
|
5864 s.pkg = name; |
|
5865 s.group = o.group; |
|
5866 |
|
5867 if (s.supersedes) { |
|
5868 sup = sup.concat(s.supersedes); |
|
5869 } |
|
5870 |
|
5871 smod = this.addModule(s, i); |
|
5872 sup.push(i); |
|
5873 |
|
5874 if (smod.skinnable) { |
|
5875 o.skinnable = true; |
|
5876 overrides = this.skin.overrides; |
|
5877 if (overrides && overrides[i]) { |
|
5878 for (j = 0; j < overrides[i].length; j++) { |
|
5879 skinname = this._addSkin(overrides[i][j], |
|
5880 i, name); |
|
5881 sup.push(skinname); |
|
5882 } |
|
5883 } |
|
5884 skinname = this._addSkin(this.skin.defaultSkin, |
|
5885 i, name); |
|
5886 sup.push(skinname); |
|
5887 } |
|
5888 |
|
5889 // looks like we are expected to work out the metadata |
|
5890 // for the parent module language packs from what is |
|
5891 // specified in the child modules. |
|
5892 if (s.lang && s.lang.length) { |
|
5893 |
|
5894 langs = yArray(s.lang); |
|
5895 for (j = 0; j < langs.length; j++) { |
|
5896 lang = langs[j]; |
|
5897 packName = this.getLangPackName(lang, name); |
|
5898 supName = this.getLangPackName(lang, i); |
|
5899 smod = this.moduleInfo[packName]; |
|
5900 |
|
5901 if (!smod) { |
|
5902 smod = this._addLangPack(lang, o, packName); |
|
5903 } |
|
5904 |
|
5905 flatSup = flatSup || yArray.hash(smod.supersedes); |
|
5906 |
|
5907 if (!(supName in flatSup)) { |
|
5908 smod.supersedes.push(supName); |
|
5909 } |
|
5910 |
|
5911 o.lang = o.lang || []; |
|
5912 |
|
5913 flatLang = flatLang || yArray.hash(o.lang); |
|
5914 |
|
5915 if (!(lang in flatLang)) { |
|
5916 o.lang.push(lang); |
|
5917 } |
|
5918 |
|
5919 // Add rollup file, need to add to supersedes list too |
|
5920 |
|
5921 // default packages |
|
5922 packName = this.getLangPackName(ROOT_LANG, name); |
|
5923 supName = this.getLangPackName(ROOT_LANG, i); |
|
5924 |
|
5925 smod = this.moduleInfo[packName]; |
|
5926 |
|
5927 if (!smod) { |
|
5928 smod = this._addLangPack(lang, o, packName); |
|
5929 } |
|
5930 |
|
5931 if (!(supName in flatSup)) { |
|
5932 smod.supersedes.push(supName); |
|
5933 } |
|
5934 |
|
5935 // Add rollup file, need to add to supersedes list too |
|
5936 |
|
5937 } |
|
5938 } |
|
5939 |
|
5940 l++; |
|
5941 } |
|
5942 } |
|
5943 //o.supersedes = YObject.keys(yArray.hash(sup)); |
|
5944 o.supersedes = yArray.dedupe(sup); |
|
5945 if (this.allowRollup) { |
|
5946 o.rollup = (l < 4) ? l : Math.min(l - 1, 4); |
|
5947 } |
|
5948 } |
|
5949 |
|
5950 plugins = o.plugins; |
|
5951 if (plugins) { |
|
5952 for (i in plugins) { |
|
5953 if (plugins.hasOwnProperty(i)) { |
|
5954 plug = plugins[i]; |
|
5955 plug.pkg = name; |
|
5956 plug.path = plug.path || _path(name, i, o.type); |
|
5957 plug.requires = plug.requires || []; |
|
5958 plug.group = o.group; |
|
5959 this.addModule(plug, i); |
|
5960 if (o.skinnable) { |
|
5961 this._addSkin(this.skin.defaultSkin, i, name); |
|
5962 } |
|
5963 |
|
5964 } |
|
5965 } |
|
5966 } |
|
5967 |
|
5968 if (o.condition) { |
|
5969 t = o.condition.trigger; |
|
5970 if (YUI.Env.aliases[t]) { |
|
5971 t = YUI.Env.aliases[t]; |
|
5972 } |
|
5973 if (!Y.Lang.isArray(t)) { |
|
5974 t = [t]; |
|
5975 } |
|
5976 |
|
5977 for (i = 0; i < t.length; i++) { |
|
5978 trigger = t[i]; |
|
5979 when = o.condition.when; |
|
5980 conditions[trigger] = conditions[trigger] || {}; |
|
5981 conditions[trigger][name] = o.condition; |
|
5982 // the 'when' attribute can be 'before', 'after', or 'instead' |
|
5983 // the default is after. |
|
5984 if (when && when !== 'after') { |
|
5985 if (when === 'instead') { // replace the trigger |
|
5986 o.supersedes = o.supersedes || []; |
|
5987 o.supersedes.push(trigger); |
|
5988 } |
|
5989 // before the trigger |
|
5990 // the trigger requires the conditional mod, |
|
5991 // so it should appear before the conditional |
|
5992 // mod if we do not intersede. |
|
5993 } else { // after the trigger |
|
5994 o.after = o.after || []; |
|
5995 o.after.push(trigger); |
|
5996 } |
|
5997 } |
|
5998 } |
|
5999 |
|
6000 if (o.supersedes) { |
|
6001 o.supersedes = this.filterRequires(o.supersedes); |
|
6002 } |
|
6003 |
|
6004 if (o.after) { |
|
6005 o.after = this.filterRequires(o.after); |
|
6006 o.after_map = yArray.hash(o.after); |
|
6007 } |
|
6008 |
|
6009 // this.dirty = true; |
|
6010 |
|
6011 if (o.configFn) { |
|
6012 ret = o.configFn(o); |
|
6013 if (ret === false) { |
|
6014 delete this.moduleInfo[name]; |
|
6015 delete GLOBAL_ENV._renderedMods[name]; |
|
6016 o = null; |
|
6017 } |
|
6018 } |
|
6019 //Add to global cache |
|
6020 if (o) { |
|
6021 if (!GLOBAL_ENV._renderedMods) { |
|
6022 GLOBAL_ENV._renderedMods = {}; |
|
6023 } |
|
6024 GLOBAL_ENV._renderedMods[name] = Y.mix(GLOBAL_ENV._renderedMods[name] || {}, o); |
|
6025 GLOBAL_ENV._conditions = conditions; |
|
6026 } |
|
6027 |
|
6028 return o; |
|
6029 }, |
|
6030 |
|
6031 /** |
|
6032 * Add a requirement for one or more module |
|
6033 * @method require |
|
6034 * @param {string[] | string*} what the modules to load. |
|
6035 */ |
|
6036 require: function(what) { |
|
6037 var a = (typeof what === 'string') ? yArray(arguments) : what; |
|
6038 this.dirty = true; |
|
6039 this.required = Y.merge(this.required, yArray.hash(this.filterRequires(a))); |
|
6040 |
|
6041 this._explodeRollups(); |
|
6042 }, |
|
6043 /** |
|
6044 * Grab all the items that were asked for, check to see if the Loader |
|
6045 * meta-data contains a "use" array. If it doesm remove the asked item and replace it with |
|
6046 * the content of the "use". |
|
6047 * This will make asking for: "dd" |
|
6048 * Actually ask for: "dd-ddm-base,dd-ddm,dd-ddm-drop,dd-drag,dd-proxy,dd-constrain,dd-drop,dd-scroll,dd-drop-plugin" |
|
6049 * @private |
|
6050 * @method _explodeRollups |
|
6051 */ |
|
6052 _explodeRollups: function() { |
|
6053 var self = this, m, m2, i, a, v, len, len2, |
|
6054 r = self.required; |
|
6055 |
|
6056 if (!self.allowRollup) { |
|
6057 for (i in r) { |
|
6058 if (r.hasOwnProperty(i)) { |
|
6059 m = self.getModule(i); |
|
6060 if (m && m.use) { |
|
6061 len = m.use.length; |
|
6062 for (a = 0; a < len; a++) { |
|
6063 m2 = self.getModule(m.use[a]); |
|
6064 if (m2 && m2.use) { |
|
6065 len2 = m2.use.length; |
|
6066 for (v = 0; v < len2; v++) { |
|
6067 r[m2.use[v]] = true; |
|
6068 } |
|
6069 } else { |
|
6070 r[m.use[a]] = true; |
|
6071 } |
|
6072 } |
|
6073 } |
|
6074 } |
|
6075 } |
|
6076 self.required = r; |
|
6077 } |
|
6078 |
|
6079 }, |
|
6080 /** |
|
6081 * Explodes the required array to remove aliases and replace them with real modules |
|
6082 * @method filterRequires |
|
6083 * @param {Array} r The original requires array |
|
6084 * @return {Array} The new array of exploded requirements |
|
6085 */ |
|
6086 filterRequires: function(r) { |
|
6087 if (r) { |
|
6088 if (!Y.Lang.isArray(r)) { |
|
6089 r = [r]; |
|
6090 } |
|
6091 r = Y.Array(r); |
|
6092 var c = [], i, mod, o, m; |
|
6093 |
|
6094 for (i = 0; i < r.length; i++) { |
|
6095 mod = this.getModule(r[i]); |
|
6096 if (mod && mod.use) { |
|
6097 for (o = 0; o < mod.use.length; o++) { |
|
6098 //Must walk the other modules in case a module is a rollup of rollups (datatype) |
|
6099 m = this.getModule(mod.use[o]); |
|
6100 if (m && m.use && (m.name !== mod.name)) { |
|
6101 c = Y.Array.dedupe([].concat(c, this.filterRequires(m.use))); |
|
6102 } else { |
|
6103 c.push(mod.use[o]); |
|
6104 } |
|
6105 } |
|
6106 } else { |
|
6107 c.push(r[i]); |
|
6108 } |
|
6109 } |
|
6110 r = c; |
|
6111 } |
|
6112 return r; |
|
6113 }, |
|
6114 /** |
|
6115 * Returns an object containing properties for all modules required |
|
6116 * in order to load the requested module |
|
6117 * @method getRequires |
|
6118 * @param {object} mod The module definition from moduleInfo. |
|
6119 * @return {array} the expanded requirement list. |
|
6120 */ |
|
6121 getRequires: function(mod) { |
|
6122 |
|
6123 if (!mod) { |
|
6124 //console.log('returning no reqs for ' + mod.name); |
|
6125 return NO_REQUIREMENTS; |
|
6126 } |
|
6127 |
|
6128 if (mod._parsed) { |
|
6129 //console.log('returning requires for ' + mod.name, mod.requires); |
|
6130 return mod.expanded || NO_REQUIREMENTS; |
|
6131 } |
|
6132 |
|
6133 //TODO add modue cache here out of scope.. |
|
6134 |
|
6135 var i, m, j, add, packName, lang, testresults = this.testresults, |
|
6136 name = mod.name, cond, |
|
6137 adddef = ON_PAGE[name] && ON_PAGE[name].details, |
|
6138 d, go, def, |
|
6139 r, old_mod, |
|
6140 o, skinmod, skindef, skinpar, skinname, |
|
6141 intl = mod.lang || mod.intl, |
|
6142 info = this.moduleInfo, |
|
6143 ftests = Y.Features && Y.Features.tests.load, |
|
6144 hash, reparse; |
|
6145 |
|
6146 // console.log(name); |
|
6147 |
|
6148 // pattern match leaves module stub that needs to be filled out |
|
6149 if (mod.temp && adddef) { |
|
6150 old_mod = mod; |
|
6151 mod = this.addModule(adddef, name); |
|
6152 mod.group = old_mod.group; |
|
6153 mod.pkg = old_mod.pkg; |
|
6154 delete mod.expanded; |
|
6155 } |
|
6156 |
|
6157 // console.log('cache: ' + mod.langCache + ' == ' + this.lang); |
|
6158 |
|
6159 //If a skin or a lang is different, reparse.. |
|
6160 reparse = !((!this.lang || mod.langCache === this.lang) && (mod.skinCache === this.skin.defaultSkin)); |
|
6161 |
|
6162 if (mod.expanded && !reparse) { |
|
6163 return mod.expanded; |
|
6164 } |
|
6165 |
|
6166 |
|
6167 d = []; |
|
6168 hash = {}; |
|
6169 r = this.filterRequires(mod.requires); |
|
6170 if (mod.lang) { |
|
6171 //If a module has a lang attribute, auto add the intl requirement. |
|
6172 d.unshift('intl'); |
|
6173 r.unshift('intl'); |
|
6174 intl = true; |
|
6175 } |
|
6176 o = this.filterRequires(mod.optional); |
|
6177 |
|
6178 |
|
6179 mod._parsed = true; |
|
6180 mod.langCache = this.lang; |
|
6181 mod.skinCache = this.skin.defaultSkin; |
|
6182 |
|
6183 for (i = 0; i < r.length; i++) { |
|
6184 if (!hash[r[i]]) { |
|
6185 d.push(r[i]); |
|
6186 hash[r[i]] = true; |
|
6187 m = this.getModule(r[i]); |
|
6188 if (m) { |
|
6189 add = this.getRequires(m); |
|
6190 intl = intl || (m.expanded_map && |
|
6191 (INTL in m.expanded_map)); |
|
6192 for (j = 0; j < add.length; j++) { |
|
6193 d.push(add[j]); |
|
6194 } |
|
6195 } |
|
6196 } |
|
6197 } |
|
6198 |
|
6199 // get the requirements from superseded modules, if any |
|
6200 r = this.filterRequires(mod.supersedes); |
|
6201 if (r) { |
|
6202 for (i = 0; i < r.length; i++) { |
|
6203 if (!hash[r[i]]) { |
|
6204 // if this module has submodules, the requirements list is |
|
6205 // expanded to include the submodules. This is so we can |
|
6206 // prevent dups when a submodule is already loaded and the |
|
6207 // parent is requested. |
|
6208 if (mod.submodules) { |
|
6209 d.push(r[i]); |
|
6210 } |
|
6211 |
|
6212 hash[r[i]] = true; |
|
6213 m = this.getModule(r[i]); |
|
6214 |
|
6215 if (m) { |
|
6216 add = this.getRequires(m); |
|
6217 intl = intl || (m.expanded_map && |
|
6218 (INTL in m.expanded_map)); |
|
6219 for (j = 0; j < add.length; j++) { |
|
6220 d.push(add[j]); |
|
6221 } |
|
6222 } |
|
6223 } |
|
6224 } |
|
6225 } |
|
6226 |
|
6227 if (o && this.loadOptional) { |
|
6228 for (i = 0; i < o.length; i++) { |
|
6229 if (!hash[o[i]]) { |
|
6230 d.push(o[i]); |
|
6231 hash[o[i]] = true; |
|
6232 m = info[o[i]]; |
|
6233 if (m) { |
|
6234 add = this.getRequires(m); |
|
6235 intl = intl || (m.expanded_map && |
|
6236 (INTL in m.expanded_map)); |
|
6237 for (j = 0; j < add.length; j++) { |
|
6238 d.push(add[j]); |
|
6239 } |
|
6240 } |
|
6241 } |
|
6242 } |
|
6243 } |
|
6244 |
|
6245 cond = this.conditions[name]; |
|
6246 |
|
6247 if (cond) { |
|
6248 //Set the module to not parsed since we have conditionals and this could change the dependency tree. |
|
6249 mod._parsed = false; |
|
6250 if (testresults && ftests) { |
|
6251 oeach(testresults, function(result, id) { |
|
6252 var condmod = ftests[id].name; |
|
6253 if (!hash[condmod] && ftests[id].trigger === name) { |
|
6254 if (result && ftests[id]) { |
|
6255 hash[condmod] = true; |
|
6256 d.push(condmod); |
|
6257 } |
|
6258 } |
|
6259 }); |
|
6260 } else { |
|
6261 for (i in cond) { |
|
6262 if (cond.hasOwnProperty(i)) { |
|
6263 if (!hash[i]) { |
|
6264 def = cond[i]; |
|
6265 //first see if they've specfied a ua check |
|
6266 //then see if they've got a test fn & if it returns true |
|
6267 //otherwise just having a condition block is enough |
|
6268 go = def && ((!def.ua && !def.test) || (def.ua && Y.UA[def.ua]) || |
|
6269 (def.test && def.test(Y, r))); |
|
6270 |
|
6271 if (go) { |
|
6272 hash[i] = true; |
|
6273 d.push(i); |
|
6274 m = this.getModule(i); |
|
6275 if (m) { |
|
6276 add = this.getRequires(m); |
|
6277 for (j = 0; j < add.length; j++) { |
|
6278 d.push(add[j]); |
|
6279 } |
|
6280 |
|
6281 } |
|
6282 } |
|
6283 } |
|
6284 } |
|
6285 } |
|
6286 } |
|
6287 } |
|
6288 |
|
6289 // Create skin modules |
|
6290 if (mod.skinnable) { |
|
6291 skindef = this.skin.overrides; |
|
6292 for (i in YUI.Env.aliases) { |
|
6293 if (YUI.Env.aliases.hasOwnProperty(i)) { |
|
6294 if (Y.Array.indexOf(YUI.Env.aliases[i], name) > -1) { |
|
6295 skinpar = i; |
|
6296 } |
|
6297 } |
|
6298 } |
|
6299 if (skindef && (skindef[name] || (skinpar && skindef[skinpar]))) { |
|
6300 skinname = name; |
|
6301 if (skindef[skinpar]) { |
|
6302 skinname = skinpar; |
|
6303 } |
|
6304 for (i = 0; i < skindef[skinname].length; i++) { |
|
6305 skinmod = this._addSkin(skindef[skinname][i], name); |
|
6306 if (!this.isCSSLoaded(skinmod, this._boot)) { |
|
6307 d.push(skinmod); |
|
6308 } |
|
6309 } |
|
6310 } else { |
|
6311 skinmod = this._addSkin(this.skin.defaultSkin, name); |
|
6312 if (!this.isCSSLoaded(skinmod, this._boot)) { |
|
6313 d.push(skinmod); |
|
6314 } |
|
6315 } |
|
6316 } |
|
6317 |
|
6318 mod._parsed = false; |
|
6319 |
|
6320 if (intl) { |
|
6321 |
|
6322 if (mod.lang && !mod.langPack && Y.Intl) { |
|
6323 lang = Y.Intl.lookupBestLang(this.lang || ROOT_LANG, mod.lang); |
|
6324 packName = this.getLangPackName(lang, name); |
|
6325 if (packName) { |
|
6326 d.unshift(packName); |
|
6327 } |
|
6328 } |
|
6329 d.unshift(INTL); |
|
6330 } |
|
6331 |
|
6332 mod.expanded_map = yArray.hash(d); |
|
6333 |
|
6334 mod.expanded = YObject.keys(mod.expanded_map); |
|
6335 |
|
6336 return mod.expanded; |
|
6337 }, |
|
6338 /** |
|
6339 * Check to see if named css module is already loaded on the page |
|
6340 * @method isCSSLoaded |
|
6341 * @param {String} name The name of the css file |
|
6342 * @return Boolean |
|
6343 */ |
|
6344 isCSSLoaded: function(name, skip) { |
|
6345 //TODO - Make this call a batching call with name being an array |
|
6346 if (!name || !YUI.Env.cssStampEl || (!skip && this.ignoreRegistered)) { |
|
6347 return false; |
|
6348 } |
|
6349 var el = YUI.Env.cssStampEl, |
|
6350 ret = false, |
|
6351 mod = YUI.Env._cssLoaded[name], |
|
6352 style = el.currentStyle; //IE |
|
6353 |
|
6354 |
|
6355 if (mod !== undefined) { |
|
6356 return mod; |
|
6357 } |
|
6358 |
|
6359 //Add the classname to the element |
|
6360 el.className = name; |
|
6361 |
|
6362 if (!style) { |
|
6363 style = Y.config.doc.defaultView.getComputedStyle(el, null); |
|
6364 } |
|
6365 |
|
6366 if (style && style.display === 'none') { |
|
6367 ret = true; |
|
6368 } |
|
6369 |
|
6370 |
|
6371 el.className = ''; //Reset the classname to '' |
|
6372 |
|
6373 YUI.Env._cssLoaded[name] = ret; |
|
6374 |
|
6375 return ret; |
|
6376 }, |
|
6377 |
|
6378 /** |
|
6379 * Returns a hash of module names the supplied module satisfies. |
|
6380 * @method getProvides |
|
6381 * @param {string} name The name of the module. |
|
6382 * @return {object} what this module provides. |
|
6383 */ |
|
6384 getProvides: function(name) { |
|
6385 var m = this.getModule(name), o, s; |
|
6386 // supmap = this.provides; |
|
6387 |
|
6388 if (!m) { |
|
6389 return NOT_FOUND; |
|
6390 } |
|
6391 |
|
6392 if (m && !m.provides) { |
|
6393 o = {}; |
|
6394 s = m.supersedes; |
|
6395 |
|
6396 if (s) { |
|
6397 yArray.each(s, function(v) { |
|
6398 Y.mix(o, this.getProvides(v)); |
|
6399 }, this); |
|
6400 } |
|
6401 |
|
6402 o[name] = true; |
|
6403 m.provides = o; |
|
6404 |
|
6405 } |
|
6406 |
|
6407 return m.provides; |
|
6408 }, |
|
6409 |
|
6410 /** |
|
6411 * Calculates the dependency tree, the result is stored in the sorted |
|
6412 * property. |
|
6413 * @method calculate |
|
6414 * @param {object} o optional options object. |
|
6415 * @param {string} type optional argument to prune modules. |
|
6416 */ |
|
6417 calculate: function(o, type) { |
|
6418 if (o || type || this.dirty) { |
|
6419 |
|
6420 if (o) { |
|
6421 this._config(o); |
|
6422 } |
|
6423 |
|
6424 if (!this._init) { |
|
6425 this._setup(); |
|
6426 } |
|
6427 |
|
6428 this._explode(); |
|
6429 |
|
6430 if (this.allowRollup) { |
|
6431 this._rollup(); |
|
6432 } else { |
|
6433 this._explodeRollups(); |
|
6434 } |
|
6435 this._reduce(); |
|
6436 this._sort(); |
|
6437 } |
|
6438 }, |
|
6439 /** |
|
6440 * Creates a "psuedo" package for languages provided in the lang array |
|
6441 * @method _addLangPack |
|
6442 * @private |
|
6443 * @param {String} lang The language to create |
|
6444 * @param {Object} m The module definition to create the language pack around |
|
6445 * @param {String} packName The name of the package (e.g: lang/datatype-date-en-US) |
|
6446 * @return {Object} The module definition |
|
6447 */ |
|
6448 _addLangPack: function(lang, m, packName) { |
|
6449 var name = m.name, |
|
6450 packPath, conf, |
|
6451 existing = this.moduleInfo[packName]; |
|
6452 |
|
6453 if (!existing) { |
|
6454 |
|
6455 packPath = _path((m.pkg || name), packName, JS, true); |
|
6456 |
|
6457 conf = { |
|
6458 path: packPath, |
|
6459 intl: true, |
|
6460 langPack: true, |
|
6461 ext: m.ext, |
|
6462 group: m.group, |
|
6463 supersedes: [] |
|
6464 }; |
|
6465 if (m.root) { |
|
6466 conf.root = m.root; |
|
6467 } |
|
6468 if (m.base) { |
|
6469 conf.base = m.base; |
|
6470 } |
|
6471 |
|
6472 if (m.configFn) { |
|
6473 conf.configFn = m.configFn; |
|
6474 } |
|
6475 |
|
6476 this.addModule(conf, packName); |
|
6477 |
|
6478 if (lang) { |
|
6479 Y.Env.lang = Y.Env.lang || {}; |
|
6480 Y.Env.lang[lang] = Y.Env.lang[lang] || {}; |
|
6481 Y.Env.lang[lang][name] = true; |
|
6482 } |
|
6483 } |
|
6484 |
|
6485 return this.moduleInfo[packName]; |
|
6486 }, |
|
6487 |
|
6488 /** |
|
6489 * Investigates the current YUI configuration on the page. By default, |
|
6490 * modules already detected will not be loaded again unless a force |
|
6491 * option is encountered. Called by calculate() |
|
6492 * @method _setup |
|
6493 * @private |
|
6494 */ |
|
6495 _setup: function() { |
|
6496 var info = this.moduleInfo, name, i, j, m, l, |
|
6497 packName; |
|
6498 |
|
6499 for (name in info) { |
|
6500 if (info.hasOwnProperty(name)) { |
|
6501 m = info[name]; |
|
6502 if (m) { |
|
6503 |
|
6504 // remove dups |
|
6505 //m.requires = YObject.keys(yArray.hash(m.requires)); |
|
6506 m.requires = yArray.dedupe(m.requires); |
|
6507 |
|
6508 // Create lang pack modules |
|
6509 //if (m.lang && m.lang.length) { |
|
6510 if (m.lang) { |
|
6511 // Setup root package if the module has lang defined, |
|
6512 // it needs to provide a root language pack |
|
6513 packName = this.getLangPackName(ROOT_LANG, name); |
|
6514 this._addLangPack(null, m, packName); |
|
6515 } |
|
6516 |
|
6517 } |
|
6518 } |
|
6519 } |
|
6520 |
|
6521 |
|
6522 //l = Y.merge(this.inserted); |
|
6523 l = {}; |
|
6524 |
|
6525 // available modules |
|
6526 if (!this.ignoreRegistered) { |
|
6527 Y.mix(l, GLOBAL_ENV.mods); |
|
6528 } |
|
6529 |
|
6530 // add the ignore list to the list of loaded packages |
|
6531 if (this.ignore) { |
|
6532 Y.mix(l, yArray.hash(this.ignore)); |
|
6533 } |
|
6534 |
|
6535 // expand the list to include superseded modules |
|
6536 for (j in l) { |
|
6537 if (l.hasOwnProperty(j)) { |
|
6538 Y.mix(l, this.getProvides(j)); |
|
6539 } |
|
6540 } |
|
6541 |
|
6542 // remove modules on the force list from the loaded list |
|
6543 if (this.force) { |
|
6544 for (i = 0; i < this.force.length; i++) { |
|
6545 if (this.force[i] in l) { |
|
6546 delete l[this.force[i]]; |
|
6547 } |
|
6548 } |
|
6549 } |
|
6550 |
|
6551 Y.mix(this.loaded, l); |
|
6552 |
|
6553 this._init = true; |
|
6554 }, |
|
6555 |
|
6556 /** |
|
6557 * Builds a module name for a language pack |
|
6558 * @method getLangPackName |
|
6559 * @param {string} lang the language code. |
|
6560 * @param {string} mname the module to build it for. |
|
6561 * @return {string} the language pack module name. |
|
6562 */ |
|
6563 getLangPackName: function(lang, mname) { |
|
6564 return ('lang/' + mname + ((lang) ? '_' + lang : '')); |
|
6565 }, |
|
6566 /** |
|
6567 * Inspects the required modules list looking for additional |
|
6568 * dependencies. Expands the required list to include all |
|
6569 * required modules. Called by calculate() |
|
6570 * @method _explode |
|
6571 * @private |
|
6572 */ |
|
6573 _explode: function() { |
|
6574 //TODO Move done out of scope |
|
6575 var r = this.required, m, reqs, done = {}, |
|
6576 self = this, name, expound; |
|
6577 |
|
6578 // the setup phase is over, all modules have been created |
|
6579 self.dirty = false; |
|
6580 |
|
6581 self._explodeRollups(); |
|
6582 r = self.required; |
|
6583 |
|
6584 for (name in r) { |
|
6585 if (r.hasOwnProperty(name)) { |
|
6586 if (!done[name]) { |
|
6587 done[name] = true; |
|
6588 m = self.getModule(name); |
|
6589 if (m) { |
|
6590 expound = m.expound; |
|
6591 |
|
6592 if (expound) { |
|
6593 r[expound] = self.getModule(expound); |
|
6594 reqs = self.getRequires(r[expound]); |
|
6595 Y.mix(r, yArray.hash(reqs)); |
|
6596 } |
|
6597 |
|
6598 reqs = self.getRequires(m); |
|
6599 Y.mix(r, yArray.hash(reqs)); |
|
6600 } |
|
6601 } |
|
6602 } |
|
6603 } |
|
6604 |
|
6605 }, |
|
6606 /** |
|
6607 * The default method used to test a module against a pattern |
|
6608 * @method _patternTest |
|
6609 * @private |
|
6610 * @param {String} mname The module being tested |
|
6611 * @param {String} pname The pattern to match |
|
6612 */ |
|
6613 _patternTest: function(mname, pname) { |
|
6614 return (mname.indexOf(pname) > -1); |
|
6615 }, |
|
6616 /** |
|
6617 * Get's the loader meta data for the requested module |
|
6618 * @method getModule |
|
6619 * @param {String} mname The module name to get |
|
6620 * @return {Object} The module metadata |
|
6621 */ |
|
6622 getModule: function(mname) { |
|
6623 //TODO: Remove name check - it's a quick hack to fix pattern WIP |
|
6624 if (!mname) { |
|
6625 return null; |
|
6626 } |
|
6627 |
|
6628 var p, found, pname, |
|
6629 m = this.moduleInfo[mname], |
|
6630 patterns = this.patterns; |
|
6631 |
|
6632 // check the patterns library to see if we should automatically add |
|
6633 // the module with defaults |
|
6634 if (!m || (m && m.ext)) { |
|
6635 for (pname in patterns) { |
|
6636 if (patterns.hasOwnProperty(pname)) { |
|
6637 p = patterns[pname]; |
|
6638 |
|
6639 //There is no test method, create a default one that tests |
|
6640 // the pattern against the mod name |
|
6641 if (!p.test) { |
|
6642 p.test = this._patternTest; |
|
6643 } |
|
6644 |
|
6645 if (p.test(mname, pname)) { |
|
6646 // use the metadata supplied for the pattern |
|
6647 // as the module definition. |
|
6648 found = p; |
|
6649 break; |
|
6650 } |
|
6651 } |
|
6652 } |
|
6653 } |
|
6654 |
|
6655 if (!m) { |
|
6656 if (found) { |
|
6657 if (p.action) { |
|
6658 p.action.call(this, mname, pname); |
|
6659 } else { |
|
6660 // ext true or false? |
|
6661 m = this.addModule(Y.merge(found), mname); |
|
6662 if (found.configFn) { |
|
6663 m.configFn = found.configFn; |
|
6664 } |
|
6665 m.temp = true; |
|
6666 } |
|
6667 } |
|
6668 } else { |
|
6669 if (found && m && found.configFn && !m.configFn) { |
|
6670 m.configFn = found.configFn; |
|
6671 m.configFn(m); |
|
6672 } |
|
6673 } |
|
6674 |
|
6675 return m; |
|
6676 }, |
|
6677 |
|
6678 // impl in rollup submodule |
|
6679 _rollup: function() { }, |
|
6680 |
|
6681 /** |
|
6682 * Remove superceded modules and loaded modules. Called by |
|
6683 * calculate() after we have the mega list of all dependencies |
|
6684 * @method _reduce |
|
6685 * @return {object} the reduced dependency hash. |
|
6686 * @private |
|
6687 */ |
|
6688 _reduce: function(r) { |
|
6689 |
|
6690 r = r || this.required; |
|
6691 |
|
6692 var i, j, s, m, type = this.loadType, |
|
6693 ignore = this.ignore ? yArray.hash(this.ignore) : false; |
|
6694 |
|
6695 for (i in r) { |
|
6696 if (r.hasOwnProperty(i)) { |
|
6697 m = this.getModule(i); |
|
6698 // remove if already loaded |
|
6699 if (((this.loaded[i] || ON_PAGE[i]) && |
|
6700 !this.forceMap[i] && !this.ignoreRegistered) || |
|
6701 (type && m && m.type !== type)) { |
|
6702 delete r[i]; |
|
6703 } |
|
6704 if (ignore && ignore[i]) { |
|
6705 delete r[i]; |
|
6706 } |
|
6707 // remove anything this module supersedes |
|
6708 s = m && m.supersedes; |
|
6709 if (s) { |
|
6710 for (j = 0; j < s.length; j++) { |
|
6711 if (s[j] in r) { |
|
6712 delete r[s[j]]; |
|
6713 } |
|
6714 } |
|
6715 } |
|
6716 } |
|
6717 } |
|
6718 |
|
6719 return r; |
|
6720 }, |
|
6721 /** |
|
6722 * Handles the queue when a module has been loaded for all cases |
|
6723 * @method _finish |
|
6724 * @private |
|
6725 * @param {String} msg The message from Loader |
|
6726 * @param {Boolean} success A boolean denoting success or failure |
|
6727 */ |
|
6728 _finish: function(msg, success) { |
|
6729 |
|
6730 _queue.running = false; |
|
6731 |
|
6732 var onEnd = this.onEnd; |
|
6733 if (onEnd) { |
|
6734 onEnd.call(this.context, { |
|
6735 msg: msg, |
|
6736 data: this.data, |
|
6737 success: success |
|
6738 }); |
|
6739 } |
|
6740 this._continue(); |
|
6741 }, |
|
6742 /** |
|
6743 * The default Loader onSuccess handler, calls this.onSuccess with a payload |
|
6744 * @method _onSuccess |
|
6745 * @private |
|
6746 */ |
|
6747 _onSuccess: function() { |
|
6748 var self = this, skipped = Y.merge(self.skipped), fn, |
|
6749 failed = [], rreg = self.requireRegistration, |
|
6750 success, msg, i, mod; |
|
6751 |
|
6752 for (i in skipped) { |
|
6753 if (skipped.hasOwnProperty(i)) { |
|
6754 delete self.inserted[i]; |
|
6755 } |
|
6756 } |
|
6757 |
|
6758 self.skipped = {}; |
|
6759 |
|
6760 for (i in self.inserted) { |
|
6761 if (self.inserted.hasOwnProperty(i)) { |
|
6762 mod = self.getModule(i); |
|
6763 if (mod && rreg && mod.type === JS && !(i in YUI.Env.mods)) { |
|
6764 failed.push(i); |
|
6765 } else { |
|
6766 Y.mix(self.loaded, self.getProvides(i)); |
|
6767 } |
|
6768 } |
|
6769 } |
|
6770 |
|
6771 fn = self.onSuccess; |
|
6772 msg = (failed.length) ? 'notregistered' : 'success'; |
|
6773 success = !(failed.length); |
|
6774 if (fn) { |
|
6775 fn.call(self.context, { |
|
6776 msg: msg, |
|
6777 data: self.data, |
|
6778 success: success, |
|
6779 failed: failed, |
|
6780 skipped: skipped |
|
6781 }); |
|
6782 } |
|
6783 self._finish(msg, success); |
|
6784 }, |
|
6785 /** |
|
6786 * The default Loader onProgress handler, calls this.onProgress with a payload |
|
6787 * @method _onProgress |
|
6788 * @private |
|
6789 */ |
|
6790 _onProgress: function(e) { |
|
6791 var self = this, i; |
|
6792 //set the internal cache to what just came in. |
|
6793 if (e.data && e.data.length) { |
|
6794 for (i = 0; i < e.data.length; i++) { |
|
6795 e.data[i] = self.getModule(e.data[i].name); |
|
6796 } |
|
6797 } |
|
6798 if (self.onProgress) { |
|
6799 self.onProgress.call(self.context, { |
|
6800 name: e.url, |
|
6801 data: e.data |
|
6802 }); |
|
6803 } |
|
6804 }, |
|
6805 /** |
|
6806 * The default Loader onFailure handler, calls this.onFailure with a payload |
|
6807 * @method _onFailure |
|
6808 * @private |
|
6809 */ |
|
6810 _onFailure: function(o) { |
|
6811 var f = this.onFailure, msg = [], i = 0, len = o.errors.length; |
|
6812 |
|
6813 for (i; i < len; i++) { |
|
6814 msg.push(o.errors[i].error); |
|
6815 } |
|
6816 |
|
6817 msg = msg.join(','); |
|
6818 |
|
6819 |
|
6820 if (f) { |
|
6821 f.call(this.context, { |
|
6822 msg: msg, |
|
6823 data: this.data, |
|
6824 success: false |
|
6825 }); |
|
6826 } |
|
6827 |
|
6828 this._finish(msg, false); |
|
6829 |
|
6830 }, |
|
6831 |
|
6832 /** |
|
6833 * The default Loader onTimeout handler, calls this.onTimeout with a payload |
|
6834 * @method _onTimeout |
|
6835 * @param {Get.Transaction} transaction The Transaction object from `Y.Get` |
|
6836 * @private |
|
6837 */ |
|
6838 _onTimeout: function(transaction) { |
|
6839 var f = this.onTimeout; |
|
6840 if (f) { |
|
6841 f.call(this.context, { |
|
6842 msg: 'timeout', |
|
6843 data: this.data, |
|
6844 success: false, |
|
6845 transaction: transaction |
|
6846 }); |
|
6847 } |
|
6848 }, |
|
6849 |
|
6850 /** |
|
6851 * Sorts the dependency tree. The last step of calculate() |
|
6852 * @method _sort |
|
6853 * @private |
|
6854 */ |
|
6855 _sort: function() { |
|
6856 |
|
6857 // create an indexed list |
|
6858 var s = YObject.keys(this.required), |
|
6859 // loaded = this.loaded, |
|
6860 //TODO Move this out of scope |
|
6861 done = {}, |
|
6862 p = 0, l, a, b, j, k, moved, doneKey; |
|
6863 |
|
6864 // keep going until we make a pass without moving anything |
|
6865 for (;;) { |
|
6866 |
|
6867 l = s.length; |
|
6868 moved = false; |
|
6869 |
|
6870 // start the loop after items that are already sorted |
|
6871 for (j = p; j < l; j++) { |
|
6872 |
|
6873 // check the next module on the list to see if its |
|
6874 // dependencies have been met |
|
6875 a = s[j]; |
|
6876 |
|
6877 // check everything below current item and move if we |
|
6878 // find a requirement for the current item |
|
6879 for (k = j + 1; k < l; k++) { |
|
6880 doneKey = a + s[k]; |
|
6881 |
|
6882 if (!done[doneKey] && this._requires(a, s[k])) { |
|
6883 |
|
6884 // extract the dependency so we can move it up |
|
6885 b = s.splice(k, 1); |
|
6886 |
|
6887 // insert the dependency above the item that |
|
6888 // requires it |
|
6889 s.splice(j, 0, b[0]); |
|
6890 |
|
6891 // only swap two dependencies once to short circut |
|
6892 // circular dependencies |
|
6893 done[doneKey] = true; |
|
6894 |
|
6895 // keep working |
|
6896 moved = true; |
|
6897 |
|
6898 break; |
|
6899 } |
|
6900 } |
|
6901 |
|
6902 // jump out of loop if we moved something |
|
6903 if (moved) { |
|
6904 break; |
|
6905 // this item is sorted, move our pointer and keep going |
|
6906 } else { |
|
6907 p++; |
|
6908 } |
|
6909 } |
|
6910 |
|
6911 // when we make it here and moved is false, we are |
|
6912 // finished sorting |
|
6913 if (!moved) { |
|
6914 break; |
|
6915 } |
|
6916 |
|
6917 } |
|
6918 |
|
6919 this.sorted = s; |
|
6920 }, |
|
6921 |
|
6922 /** |
|
6923 * Handles the actual insertion of script/link tags |
|
6924 * @method _insert |
|
6925 * @private |
|
6926 * @param {Object} source The YUI instance the request came from |
|
6927 * @param {Object} o The metadata to include |
|
6928 * @param {String} type JS or CSS |
|
6929 * @param {Boolean} [skipcalc=false] Do a Loader.calculate on the meta |
|
6930 */ |
|
6931 _insert: function(source, o, type, skipcalc) { |
|
6932 |
|
6933 |
|
6934 // restore the state at the time of the request |
|
6935 if (source) { |
|
6936 this._config(source); |
|
6937 } |
|
6938 |
|
6939 // build the dependency list |
|
6940 // don't include type so we can process CSS and script in |
|
6941 // one pass when the type is not specified. |
|
6942 |
|
6943 var modules = this.resolve(!skipcalc), |
|
6944 self = this, comp = 0, actions = 0, |
|
6945 mods = {}, deps, complete; |
|
6946 |
|
6947 self._refetch = []; |
|
6948 |
|
6949 if (type) { |
|
6950 //Filter out the opposite type and reset the array so the checks later work |
|
6951 modules[((type === JS) ? CSS : JS)] = []; |
|
6952 } |
|
6953 if (!self.fetchCSS) { |
|
6954 modules.css = []; |
|
6955 } |
|
6956 if (modules.js.length) { |
|
6957 comp++; |
|
6958 } |
|
6959 if (modules.css.length) { |
|
6960 comp++; |
|
6961 } |
|
6962 |
|
6963 //console.log('Resolved Modules: ', modules); |
|
6964 |
|
6965 complete = function(d) { |
|
6966 actions++; |
|
6967 var errs = {}, i = 0, o = 0, u = '', fn, |
|
6968 modName, resMods; |
|
6969 |
|
6970 if (d && d.errors) { |
|
6971 for (i = 0; i < d.errors.length; i++) { |
|
6972 if (d.errors[i].request) { |
|
6973 u = d.errors[i].request.url; |
|
6974 } else { |
|
6975 u = d.errors[i]; |
|
6976 } |
|
6977 errs[u] = u; |
|
6978 } |
|
6979 } |
|
6980 |
|
6981 if (d && d.data && d.data.length && (d.type === 'success')) { |
|
6982 for (i = 0; i < d.data.length; i++) { |
|
6983 self.inserted[d.data[i].name] = true; |
|
6984 //If the external module has a skin or a lang, reprocess it |
|
6985 if (d.data[i].lang || d.data[i].skinnable) { |
|
6986 delete self.inserted[d.data[i].name]; |
|
6987 self._refetch.push(d.data[i].name); |
|
6988 } |
|
6989 } |
|
6990 } |
|
6991 |
|
6992 if (actions === comp) { |
|
6993 self._loading = null; |
|
6994 if (self._refetch.length) { |
|
6995 //Get the deps for the new meta-data and reprocess |
|
6996 for (i = 0; i < self._refetch.length; i++) { |
|
6997 deps = self.getRequires(self.getModule(self._refetch[i])); |
|
6998 for (o = 0; o < deps.length; o++) { |
|
6999 if (!self.inserted[deps[o]]) { |
|
7000 //We wouldn't be to this point without the module being here |
|
7001 mods[deps[o]] = deps[o]; |
|
7002 } |
|
7003 } |
|
7004 } |
|
7005 mods = Y.Object.keys(mods); |
|
7006 if (mods.length) { |
|
7007 self.require(mods); |
|
7008 resMods = self.resolve(true); |
|
7009 if (resMods.cssMods.length) { |
|
7010 for (i=0; i < resMods.cssMods.length; i++) { |
|
7011 modName = resMods.cssMods[i].name; |
|
7012 delete YUI.Env._cssLoaded[modName]; |
|
7013 if (self.isCSSLoaded(modName)) { |
|
7014 self.inserted[modName] = true; |
|
7015 delete self.required[modName]; |
|
7016 } |
|
7017 } |
|
7018 self.sorted = []; |
|
7019 self._sort(); |
|
7020 } |
|
7021 d = null; //bail |
|
7022 self._insert(); //insert the new deps |
|
7023 } |
|
7024 } |
|
7025 if (d && d.fn) { |
|
7026 fn = d.fn; |
|
7027 delete d.fn; |
|
7028 fn.call(self, d); |
|
7029 } |
|
7030 } |
|
7031 }; |
|
7032 |
|
7033 this._loading = true; |
|
7034 |
|
7035 if (!modules.js.length && !modules.css.length) { |
|
7036 actions = -1; |
|
7037 complete({ |
|
7038 fn: self._onSuccess |
|
7039 }); |
|
7040 return; |
|
7041 } |
|
7042 |
|
7043 |
|
7044 if (modules.css.length) { //Load CSS first |
|
7045 Y.Get.css(modules.css, { |
|
7046 data: modules.cssMods, |
|
7047 attributes: self.cssAttributes, |
|
7048 insertBefore: self.insertBefore, |
|
7049 charset: self.charset, |
|
7050 timeout: self.timeout, |
|
7051 context: self, |
|
7052 onProgress: function(e) { |
|
7053 self._onProgress.call(self, e); |
|
7054 }, |
|
7055 onTimeout: function(d) { |
|
7056 self._onTimeout.call(self, d); |
|
7057 }, |
|
7058 onSuccess: function(d) { |
|
7059 d.type = 'success'; |
|
7060 d.fn = self._onSuccess; |
|
7061 complete.call(self, d); |
|
7062 }, |
|
7063 onFailure: function(d) { |
|
7064 d.type = 'failure'; |
|
7065 d.fn = self._onFailure; |
|
7066 complete.call(self, d); |
|
7067 } |
|
7068 }); |
|
7069 } |
|
7070 |
|
7071 if (modules.js.length) { |
|
7072 Y.Get.js(modules.js, { |
|
7073 data: modules.jsMods, |
|
7074 insertBefore: self.insertBefore, |
|
7075 attributes: self.jsAttributes, |
|
7076 charset: self.charset, |
|
7077 timeout: self.timeout, |
|
7078 autopurge: false, |
|
7079 context: self, |
|
7080 async: self.async, |
|
7081 onProgress: function(e) { |
|
7082 self._onProgress.call(self, e); |
|
7083 }, |
|
7084 onTimeout: function(d) { |
|
7085 self._onTimeout.call(self, d); |
|
7086 }, |
|
7087 onSuccess: function(d) { |
|
7088 d.type = 'success'; |
|
7089 d.fn = self._onSuccess; |
|
7090 complete.call(self, d); |
|
7091 }, |
|
7092 onFailure: function(d) { |
|
7093 d.type = 'failure'; |
|
7094 d.fn = self._onFailure; |
|
7095 complete.call(self, d); |
|
7096 } |
|
7097 }); |
|
7098 } |
|
7099 }, |
|
7100 /** |
|
7101 * Once a loader operation is completely finished, process any additional queued items. |
|
7102 * @method _continue |
|
7103 * @private |
|
7104 */ |
|
7105 _continue: function() { |
|
7106 if (!(_queue.running) && _queue.size() > 0) { |
|
7107 _queue.running = true; |
|
7108 _queue.next()(); |
|
7109 } |
|
7110 }, |
|
7111 |
|
7112 /** |
|
7113 * inserts the requested modules and their dependencies. |
|
7114 * <code>type</code> can be "js" or "css". Both script and |
|
7115 * css are inserted if type is not provided. |
|
7116 * @method insert |
|
7117 * @param {object} o optional options object. |
|
7118 * @param {string} type the type of dependency to insert. |
|
7119 */ |
|
7120 insert: function(o, type, skipsort) { |
|
7121 var self = this, copy = Y.merge(this); |
|
7122 delete copy.require; |
|
7123 delete copy.dirty; |
|
7124 _queue.add(function() { |
|
7125 self._insert(copy, o, type, skipsort); |
|
7126 }); |
|
7127 this._continue(); |
|
7128 }, |
|
7129 |
|
7130 /** |
|
7131 * Executed every time a module is loaded, and if we are in a load |
|
7132 * cycle, we attempt to load the next script. Public so that it |
|
7133 * is possible to call this if using a method other than |
|
7134 * Y.register to determine when scripts are fully loaded |
|
7135 * @method loadNext |
|
7136 * @deprecated |
|
7137 * @param {string} mname optional the name of the module that has |
|
7138 * been loaded (which is usually why it is time to load the next |
|
7139 * one). |
|
7140 */ |
|
7141 loadNext: function() { |
|
7142 return; |
|
7143 }, |
|
7144 |
|
7145 /** |
|
7146 * Apply filter defined for this instance to a url/path |
|
7147 * @method _filter |
|
7148 * @param {string} u the string to filter. |
|
7149 * @param {string} name the name of the module, if we are processing |
|
7150 * a single module as opposed to a combined url. |
|
7151 * @return {string} the filtered string. |
|
7152 * @private |
|
7153 */ |
|
7154 _filter: function(u, name, group) { |
|
7155 var f = this.filter, |
|
7156 hasFilter = name && (name in this.filters), |
|
7157 modFilter = hasFilter && this.filters[name], |
|
7158 groupName = group || (this.moduleInfo[name] ? this.moduleInfo[name].group : null); |
|
7159 |
|
7160 if (groupName && this.groups[groupName] && this.groups[groupName].filter) { |
|
7161 modFilter = this.groups[groupName].filter; |
|
7162 hasFilter = true; |
|
7163 } |
|
7164 |
|
7165 if (u) { |
|
7166 if (hasFilter) { |
|
7167 f = (L.isString(modFilter)) ? this.FILTER_DEFS[modFilter.toUpperCase()] || null : modFilter; |
|
7168 } |
|
7169 if (f) { |
|
7170 u = u.replace(new RegExp(f.searchExp, 'g'), f.replaceStr); |
|
7171 } |
|
7172 } |
|
7173 return u; |
|
7174 }, |
|
7175 |
|
7176 /** |
|
7177 * Generates the full url for a module |
|
7178 * @method _url |
|
7179 * @param {string} path the path fragment. |
|
7180 * @param {String} name The name of the module |
|
7181 * @param {String} [base=self.base] The base url to use |
|
7182 * @return {string} the full url. |
|
7183 * @private |
|
7184 */ |
|
7185 _url: function(path, name, base) { |
|
7186 return this._filter((base || this.base || '') + path, name); |
|
7187 }, |
|
7188 /** |
|
7189 * Returns an Object hash of file arrays built from `loader.sorted` or from an arbitrary list of sorted modules. |
|
7190 * @method resolve |
|
7191 * @param {Boolean} [calc=false] Perform a loader.calculate() before anything else |
|
7192 * @param {Array} [s=loader.sorted] An override for the loader.sorted array |
|
7193 * @return {Object} Object hash (js and css) of two arrays of file lists |
|
7194 * @example This method can be used as an off-line dep calculator |
|
7195 * |
|
7196 * var Y = YUI(); |
|
7197 * var loader = new Y.Loader({ |
|
7198 * filter: 'debug', |
|
7199 * base: '../../', |
|
7200 * root: 'build/', |
|
7201 * combine: true, |
|
7202 * require: ['node', 'dd', 'console'] |
|
7203 * }); |
|
7204 * var out = loader.resolve(true); |
|
7205 * |
|
7206 */ |
|
7207 resolve: function(calc, s) { |
|
7208 |
|
7209 var len, i, m, url, group, groupName, j, frag, |
|
7210 comboSource, comboSources, mods, comboBase, |
|
7211 base, urls, u = [], tmpBase, baseLen, resCombos = {}, |
|
7212 self = this, comboSep, maxURLLength, |
|
7213 inserted = (self.ignoreRegistered) ? {} : self.inserted, |
|
7214 resolved = { js: [], jsMods: [], css: [], cssMods: [] }, |
|
7215 type = self.loadType || 'js', addSingle; |
|
7216 |
|
7217 if (self.skin.overrides || self.skin.defaultSkin !== DEFAULT_SKIN || self.ignoreRegistered) { |
|
7218 self._resetModules(); |
|
7219 } |
|
7220 |
|
7221 if (calc) { |
|
7222 self.calculate(); |
|
7223 } |
|
7224 s = s || self.sorted; |
|
7225 |
|
7226 addSingle = function(m) { |
|
7227 |
|
7228 if (m) { |
|
7229 group = (m.group && self.groups[m.group]) || NOT_FOUND; |
|
7230 |
|
7231 //Always assume it's async |
|
7232 if (group.async === false) { |
|
7233 m.async = group.async; |
|
7234 } |
|
7235 |
|
7236 url = (m.fullpath) ? self._filter(m.fullpath, s[i]) : |
|
7237 self._url(m.path, s[i], group.base || m.base); |
|
7238 |
|
7239 if (m.attributes || m.async === false) { |
|
7240 url = { |
|
7241 url: url, |
|
7242 async: m.async |
|
7243 }; |
|
7244 if (m.attributes) { |
|
7245 url.attributes = m.attributes; |
|
7246 } |
|
7247 } |
|
7248 resolved[m.type].push(url); |
|
7249 resolved[m.type + 'Mods'].push(m); |
|
7250 } else { |
|
7251 } |
|
7252 |
|
7253 }; |
|
7254 |
|
7255 len = s.length; |
|
7256 |
|
7257 // the default combo base |
|
7258 comboBase = self.comboBase; |
|
7259 |
|
7260 url = comboBase; |
|
7261 |
|
7262 comboSources = {}; |
|
7263 |
|
7264 for (i = 0; i < len; i++) { |
|
7265 comboSource = comboBase; |
|
7266 m = self.getModule(s[i]); |
|
7267 groupName = m && m.group; |
|
7268 group = self.groups[groupName]; |
|
7269 if (groupName && group) { |
|
7270 |
|
7271 if (!group.combine || m.fullpath) { |
|
7272 //This is not a combo module, skip it and load it singly later. |
|
7273 addSingle(m); |
|
7274 continue; |
|
7275 } |
|
7276 m.combine = true; |
|
7277 if (group.comboBase) { |
|
7278 comboSource = group.comboBase; |
|
7279 } |
|
7280 |
|
7281 if ("root" in group && L.isValue(group.root)) { |
|
7282 m.root = group.root; |
|
7283 } |
|
7284 m.comboSep = group.comboSep || self.comboSep; |
|
7285 m.maxURLLength = group.maxURLLength || self.maxURLLength; |
|
7286 } else { |
|
7287 if (!self.combine) { |
|
7288 //This is not a combo module, skip it and load it singly later. |
|
7289 addSingle(m); |
|
7290 continue; |
|
7291 } |
|
7292 } |
|
7293 |
|
7294 comboSources[comboSource] = comboSources[comboSource] || []; |
|
7295 comboSources[comboSource].push(m); |
|
7296 } |
|
7297 |
|
7298 for (j in comboSources) { |
|
7299 if (comboSources.hasOwnProperty(j)) { |
|
7300 resCombos[j] = resCombos[j] || { js: [], jsMods: [], css: [], cssMods: [] }; |
|
7301 url = j; |
|
7302 mods = comboSources[j]; |
|
7303 len = mods.length; |
|
7304 |
|
7305 if (len) { |
|
7306 for (i = 0; i < len; i++) { |
|
7307 if (inserted[mods[i]]) { |
|
7308 continue; |
|
7309 } |
|
7310 m = mods[i]; |
|
7311 // Do not try to combine non-yui JS unless combo def |
|
7312 // is found |
|
7313 if (m && (m.combine || !m.ext)) { |
|
7314 resCombos[j].comboSep = m.comboSep; |
|
7315 resCombos[j].group = m.group; |
|
7316 resCombos[j].maxURLLength = m.maxURLLength; |
|
7317 frag = ((L.isValue(m.root)) ? m.root : self.root) + (m.path || m.fullpath); |
|
7318 frag = self._filter(frag, m.name); |
|
7319 resCombos[j][m.type].push(frag); |
|
7320 resCombos[j][m.type + 'Mods'].push(m); |
|
7321 } else { |
|
7322 //Add them to the next process.. |
|
7323 if (mods[i]) { |
|
7324 addSingle(mods[i]); |
|
7325 } |
|
7326 } |
|
7327 |
|
7328 } |
|
7329 } |
|
7330 } |
|
7331 } |
|
7332 |
|
7333 |
|
7334 for (j in resCombos) { |
|
7335 if (resCombos.hasOwnProperty(j)) { |
|
7336 base = j; |
|
7337 comboSep = resCombos[base].comboSep || self.comboSep; |
|
7338 maxURLLength = resCombos[base].maxURLLength || self.maxURLLength; |
|
7339 for (type in resCombos[base]) { |
|
7340 if (type === JS || type === CSS) { |
|
7341 urls = resCombos[base][type]; |
|
7342 mods = resCombos[base][type + 'Mods']; |
|
7343 len = urls.length; |
|
7344 tmpBase = base + urls.join(comboSep); |
|
7345 baseLen = tmpBase.length; |
|
7346 if (maxURLLength <= base.length) { |
|
7347 maxURLLength = MAX_URL_LENGTH; |
|
7348 } |
|
7349 |
|
7350 if (len) { |
|
7351 if (baseLen > maxURLLength) { |
|
7352 u = []; |
|
7353 for (s = 0; s < len; s++) { |
|
7354 u.push(urls[s]); |
|
7355 tmpBase = base + u.join(comboSep); |
|
7356 |
|
7357 if (tmpBase.length > maxURLLength) { |
|
7358 m = u.pop(); |
|
7359 tmpBase = base + u.join(comboSep); |
|
7360 resolved[type].push(self._filter(tmpBase, null, resCombos[base].group)); |
|
7361 u = []; |
|
7362 if (m) { |
|
7363 u.push(m); |
|
7364 } |
|
7365 } |
|
7366 } |
|
7367 if (u.length) { |
|
7368 tmpBase = base + u.join(comboSep); |
|
7369 resolved[type].push(self._filter(tmpBase, null, resCombos[base].group)); |
|
7370 } |
|
7371 } else { |
|
7372 resolved[type].push(self._filter(tmpBase, null, resCombos[base].group)); |
|
7373 } |
|
7374 } |
|
7375 resolved[type + 'Mods'] = resolved[type + 'Mods'].concat(mods); |
|
7376 } |
|
7377 } |
|
7378 } |
|
7379 } |
|
7380 |
|
7381 resCombos = null; |
|
7382 |
|
7383 return resolved; |
|
7384 }, |
|
7385 /** |
|
7386 Shortcut to calculate, resolve and load all modules. |
|
7387 |
|
7388 var loader = new Y.Loader({ |
|
7389 ignoreRegistered: true, |
|
7390 modules: { |
|
7391 mod: { |
|
7392 path: 'mod.js' |
|
7393 } |
|
7394 }, |
|
7395 requires: [ 'mod' ] |
|
7396 }); |
|
7397 loader.load(function() { |
|
7398 console.log('All modules have loaded..'); |
|
7399 }); |
|
7400 |
|
7401 |
|
7402 @method load |
|
7403 @param {Callback} cb Executed after all load operations are complete |
|
7404 */ |
|
7405 load: function(cb) { |
|
7406 if (!cb) { |
|
7407 return; |
|
7408 } |
|
7409 var self = this, |
|
7410 out = self.resolve(true); |
|
7411 |
|
7412 self.data = out; |
|
7413 |
|
7414 self.onEnd = function() { |
|
7415 cb.apply(self.context || self, arguments); |
|
7416 }; |
|
7417 |
|
7418 self.insert(); |
|
7419 } |
|
7420 }; |
|
7421 |
|
7422 |
|
7423 |
|
7424 }, '3.10.3', {"requires": ["get", "features"]}); |
|
7425 YUI.add('loader-rollup', function (Y, NAME) { |
|
7426 |
|
7427 /** |
|
7428 * Optional automatic rollup logic for reducing http connections |
|
7429 * when not using a combo service. |
|
7430 * @module loader |
|
7431 * @submodule rollup |
|
7432 */ |
|
7433 |
|
7434 /** |
|
7435 * Look for rollup packages to determine if all of the modules a |
|
7436 * rollup supersedes are required. If so, include the rollup to |
|
7437 * help reduce the total number of connections required. Called |
|
7438 * by calculate(). This is an optional feature, and requires the |
|
7439 * appropriate submodule to function. |
|
7440 * @method _rollup |
|
7441 * @for Loader |
|
7442 * @private |
|
7443 */ |
|
7444 Y.Loader.prototype._rollup = function() { |
|
7445 var i, j, m, s, r = this.required, roll, |
|
7446 info = this.moduleInfo, rolled, c, smod; |
|
7447 |
|
7448 // find and cache rollup modules |
|
7449 if (this.dirty || !this.rollups) { |
|
7450 this.rollups = {}; |
|
7451 for (i in info) { |
|
7452 if (info.hasOwnProperty(i)) { |
|
7453 m = this.getModule(i); |
|
7454 // if (m && m.rollup && m.supersedes) { |
|
7455 if (m && m.rollup) { |
|
7456 this.rollups[i] = m; |
|
7457 } |
|
7458 } |
|
7459 } |
|
7460 } |
|
7461 |
|
7462 // make as many passes as needed to pick up rollup rollups |
|
7463 for (;;) { |
|
7464 rolled = false; |
|
7465 |
|
7466 // go through the rollup candidates |
|
7467 for (i in this.rollups) { |
|
7468 if (this.rollups.hasOwnProperty(i)) { |
|
7469 // there can be only one, unless forced |
|
7470 if (!r[i] && ((!this.loaded[i]) || this.forceMap[i])) { |
|
7471 m = this.getModule(i); |
|
7472 s = m.supersedes || []; |
|
7473 roll = false; |
|
7474 |
|
7475 // @TODO remove continue |
|
7476 if (!m.rollup) { |
|
7477 continue; |
|
7478 } |
|
7479 |
|
7480 c = 0; |
|
7481 |
|
7482 // check the threshold |
|
7483 for (j = 0; j < s.length; j++) { |
|
7484 smod = info[s[j]]; |
|
7485 |
|
7486 // if the superseded module is loaded, we can't |
|
7487 // load the rollup unless it has been forced. |
|
7488 if (this.loaded[s[j]] && !this.forceMap[s[j]]) { |
|
7489 roll = false; |
|
7490 break; |
|
7491 // increment the counter if this module is required. |
|
7492 // if we are beyond the rollup threshold, we will |
|
7493 // use the rollup module |
|
7494 } else if (r[s[j]] && m.type === smod.type) { |
|
7495 c++; |
|
7496 roll = (c >= m.rollup); |
|
7497 if (roll) { |
|
7498 break; |
|
7499 } |
|
7500 } |
|
7501 } |
|
7502 |
|
7503 if (roll) { |
|
7504 // add the rollup |
|
7505 r[i] = true; |
|
7506 rolled = true; |
|
7507 |
|
7508 // expand the rollup's dependencies |
|
7509 this.getRequires(m); |
|
7510 } |
|
7511 } |
|
7512 } |
|
7513 } |
|
7514 |
|
7515 // if we made it here w/o rolling up something, we are done |
|
7516 if (!rolled) { |
|
7517 break; |
|
7518 } |
|
7519 } |
|
7520 }; |
|
7521 |
|
7522 |
|
7523 }, '3.10.3', {"requires": ["loader-base"]}); |
|
7524 YUI.add('loader-yui3', function (Y, NAME) { |
|
7525 |
|
7526 /* This file is auto-generated by (yogi loader --yes --mix --start ../) */ |
|
7527 |
|
7528 /*jshint maxlen:900, eqeqeq: false */ |
|
7529 |
|
7530 /** |
|
7531 * YUI 3 module metadata |
|
7532 * @module loader |
|
7533 * @submodule loader-yui3 |
|
7534 */ |
|
7535 YUI.Env[Y.version].modules = YUI.Env[Y.version].modules || {}; |
|
7536 Y.mix(YUI.Env[Y.version].modules, { |
|
7537 "align-plugin": { |
|
7538 "requires": [ |
|
7539 "node-screen", |
|
7540 "node-pluginhost" |
|
7541 ] |
|
7542 }, |
|
7543 "anim": { |
|
7544 "use": [ |
|
7545 "anim-base", |
|
7546 "anim-color", |
|
7547 "anim-curve", |
|
7548 "anim-easing", |
|
7549 "anim-node-plugin", |
|
7550 "anim-scroll", |
|
7551 "anim-xy" |
|
7552 ] |
|
7553 }, |
|
7554 "anim-base": { |
|
7555 "requires": [ |
|
7556 "base-base", |
|
7557 "node-style" |
|
7558 ] |
|
7559 }, |
|
7560 "anim-color": { |
|
7561 "requires": [ |
|
7562 "anim-base" |
|
7563 ] |
|
7564 }, |
|
7565 "anim-curve": { |
|
7566 "requires": [ |
|
7567 "anim-xy" |
|
7568 ] |
|
7569 }, |
|
7570 "anim-easing": { |
|
7571 "requires": [ |
|
7572 "anim-base" |
|
7573 ] |
|
7574 }, |
|
7575 "anim-node-plugin": { |
|
7576 "requires": [ |
|
7577 "node-pluginhost", |
|
7578 "anim-base" |
|
7579 ] |
|
7580 }, |
|
7581 "anim-scroll": { |
|
7582 "requires": [ |
|
7583 "anim-base" |
|
7584 ] |
|
7585 }, |
|
7586 "anim-shape": { |
|
7587 "requires": [ |
|
7588 "anim-base", |
|
7589 "anim-easing", |
|
7590 "anim-color", |
|
7591 "matrix" |
|
7592 ] |
|
7593 }, |
|
7594 "anim-shape-transform": { |
|
7595 "use": [ |
|
7596 "anim-shape" |
|
7597 ] |
|
7598 }, |
|
7599 "anim-xy": { |
|
7600 "requires": [ |
|
7601 "anim-base", |
|
7602 "node-screen" |
|
7603 ] |
|
7604 }, |
|
7605 "app": { |
|
7606 "use": [ |
|
7607 "app-base", |
|
7608 "app-content", |
|
7609 "app-transitions", |
|
7610 "lazy-model-list", |
|
7611 "model", |
|
7612 "model-list", |
|
7613 "model-sync-rest", |
|
7614 "router", |
|
7615 "view", |
|
7616 "view-node-map" |
|
7617 ] |
|
7618 }, |
|
7619 "app-base": { |
|
7620 "requires": [ |
|
7621 "classnamemanager", |
|
7622 "pjax-base", |
|
7623 "router", |
|
7624 "view" |
|
7625 ] |
|
7626 }, |
|
7627 "app-content": { |
|
7628 "requires": [ |
|
7629 "app-base", |
|
7630 "pjax-content" |
|
7631 ] |
|
7632 }, |
|
7633 "app-transitions": { |
|
7634 "requires": [ |
|
7635 "app-base" |
|
7636 ] |
|
7637 }, |
|
7638 "app-transitions-css": { |
|
7639 "type": "css" |
|
7640 }, |
|
7641 "app-transitions-native": { |
|
7642 "condition": { |
|
7643 "name": "app-transitions-native", |
|
7644 "test": function (Y) { |
|
7645 var doc = Y.config.doc, |
|
7646 node = doc ? doc.documentElement : null; |
|
7647 |
|
7648 if (node && node.style) { |
|
7649 return ('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); |
|
7650 } |
|
7651 |
|
7652 return false; |
|
7653 }, |
|
7654 "trigger": "app-transitions" |
|
7655 }, |
|
7656 "requires": [ |
|
7657 "app-transitions", |
|
7658 "app-transitions-css", |
|
7659 "parallel", |
|
7660 "transition" |
|
7661 ] |
|
7662 }, |
|
7663 "array-extras": { |
|
7664 "requires": [ |
|
7665 "yui-base" |
|
7666 ] |
|
7667 }, |
|
7668 "array-invoke": { |
|
7669 "requires": [ |
|
7670 "yui-base" |
|
7671 ] |
|
7672 }, |
|
7673 "arraylist": { |
|
7674 "requires": [ |
|
7675 "yui-base" |
|
7676 ] |
|
7677 }, |
|
7678 "arraylist-add": { |
|
7679 "requires": [ |
|
7680 "arraylist" |
|
7681 ] |
|
7682 }, |
|
7683 "arraylist-filter": { |
|
7684 "requires": [ |
|
7685 "arraylist" |
|
7686 ] |
|
7687 }, |
|
7688 "arraysort": { |
|
7689 "requires": [ |
|
7690 "yui-base" |
|
7691 ] |
|
7692 }, |
|
7693 "async-queue": { |
|
7694 "requires": [ |
|
7695 "event-custom" |
|
7696 ] |
|
7697 }, |
|
7698 "attribute": { |
|
7699 "use": [ |
|
7700 "attribute-base", |
|
7701 "attribute-complex" |
|
7702 ] |
|
7703 }, |
|
7704 "attribute-base": { |
|
7705 "requires": [ |
|
7706 "attribute-core", |
|
7707 "attribute-observable", |
|
7708 "attribute-extras" |
|
7709 ] |
|
7710 }, |
|
7711 "attribute-complex": { |
|
7712 "requires": [ |
|
7713 "attribute-base" |
|
7714 ] |
|
7715 }, |
|
7716 "attribute-core": { |
|
7717 "requires": [ |
|
7718 "oop" |
|
7719 ] |
|
7720 }, |
|
7721 "attribute-events": { |
|
7722 "use": [ |
|
7723 "attribute-observable" |
|
7724 ] |
|
7725 }, |
|
7726 "attribute-extras": { |
|
7727 "requires": [ |
|
7728 "oop" |
|
7729 ] |
|
7730 }, |
|
7731 "attribute-observable": { |
|
7732 "requires": [ |
|
7733 "event-custom" |
|
7734 ] |
|
7735 }, |
|
7736 "autocomplete": { |
|
7737 "use": [ |
|
7738 "autocomplete-base", |
|
7739 "autocomplete-sources", |
|
7740 "autocomplete-list", |
|
7741 "autocomplete-plugin" |
|
7742 ] |
|
7743 }, |
|
7744 "autocomplete-base": { |
|
7745 "optional": [ |
|
7746 "autocomplete-sources" |
|
7747 ], |
|
7748 "requires": [ |
|
7749 "array-extras", |
|
7750 "base-build", |
|
7751 "escape", |
|
7752 "event-valuechange", |
|
7753 "node-base" |
|
7754 ] |
|
7755 }, |
|
7756 "autocomplete-filters": { |
|
7757 "requires": [ |
|
7758 "array-extras", |
|
7759 "text-wordbreak" |
|
7760 ] |
|
7761 }, |
|
7762 "autocomplete-filters-accentfold": { |
|
7763 "requires": [ |
|
7764 "array-extras", |
|
7765 "text-accentfold", |
|
7766 "text-wordbreak" |
|
7767 ] |
|
7768 }, |
|
7769 "autocomplete-highlighters": { |
|
7770 "requires": [ |
|
7771 "array-extras", |
|
7772 "highlight-base" |
|
7773 ] |
|
7774 }, |
|
7775 "autocomplete-highlighters-accentfold": { |
|
7776 "requires": [ |
|
7777 "array-extras", |
|
7778 "highlight-accentfold" |
|
7779 ] |
|
7780 }, |
|
7781 "autocomplete-list": { |
|
7782 "after": [ |
|
7783 "autocomplete-sources" |
|
7784 ], |
|
7785 "lang": [ |
|
7786 "en", |
|
7787 "es", |
|
7788 "it" |
|
7789 ], |
|
7790 "requires": [ |
|
7791 "autocomplete-base", |
|
7792 "event-resize", |
|
7793 "node-screen", |
|
7794 "selector-css3", |
|
7795 "shim-plugin", |
|
7796 "widget", |
|
7797 "widget-position", |
|
7798 "widget-position-align" |
|
7799 ], |
|
7800 "skinnable": true |
|
7801 }, |
|
7802 "autocomplete-list-keys": { |
|
7803 "condition": { |
|
7804 "name": "autocomplete-list-keys", |
|
7805 "test": function (Y) { |
|
7806 // Only add keyboard support to autocomplete-list if this doesn't appear to |
|
7807 // be an iOS or Android-based mobile device. |
|
7808 // |
|
7809 // There's currently no feasible way to actually detect whether a device has |
|
7810 // a hardware keyboard, so this sniff will have to do. It can easily be |
|
7811 // overridden by manually loading the autocomplete-list-keys module. |
|
7812 // |
|
7813 // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari |
|
7814 // doesn't fire the keyboard events used by AutoCompleteList, so there's |
|
7815 // no point loading the -keys module even when a bluetooth keyboard may be |
|
7816 // available. |
|
7817 return !(Y.UA.ios || Y.UA.android); |
|
7818 }, |
|
7819 "trigger": "autocomplete-list" |
|
7820 }, |
|
7821 "requires": [ |
|
7822 "autocomplete-list", |
|
7823 "base-build" |
|
7824 ] |
|
7825 }, |
|
7826 "autocomplete-plugin": { |
|
7827 "requires": [ |
|
7828 "autocomplete-list", |
|
7829 "node-pluginhost" |
|
7830 ] |
|
7831 }, |
|
7832 "autocomplete-sources": { |
|
7833 "optional": [ |
|
7834 "io-base", |
|
7835 "json-parse", |
|
7836 "jsonp", |
|
7837 "yql" |
|
7838 ], |
|
7839 "requires": [ |
|
7840 "autocomplete-base" |
|
7841 ] |
|
7842 }, |
|
7843 "axes": { |
|
7844 "use": [ |
|
7845 "axis-numeric", |
|
7846 "axis-category", |
|
7847 "axis-time", |
|
7848 "axis-stacked" |
|
7849 ] |
|
7850 }, |
|
7851 "axes-base": { |
|
7852 "use": [ |
|
7853 "axis-numeric-base", |
|
7854 "axis-category-base", |
|
7855 "axis-time-base", |
|
7856 "axis-stacked-base" |
|
7857 ] |
|
7858 }, |
|
7859 "axis": { |
|
7860 "requires": [ |
|
7861 "dom", |
|
7862 "widget", |
|
7863 "widget-position", |
|
7864 "widget-stack", |
|
7865 "graphics", |
|
7866 "axis-base" |
|
7867 ] |
|
7868 }, |
|
7869 "axis-base": { |
|
7870 "requires": [ |
|
7871 "classnamemanager", |
|
7872 "datatype-number", |
|
7873 "datatype-date", |
|
7874 "base", |
|
7875 "event-custom" |
|
7876 ] |
|
7877 }, |
|
7878 "axis-category": { |
|
7879 "requires": [ |
|
7880 "axis", |
|
7881 "axis-category-base" |
|
7882 ] |
|
7883 }, |
|
7884 "axis-category-base": { |
|
7885 "requires": [ |
|
7886 "axis-base" |
|
7887 ] |
|
7888 }, |
|
7889 "axis-numeric": { |
|
7890 "requires": [ |
|
7891 "axis", |
|
7892 "axis-numeric-base" |
|
7893 ] |
|
7894 }, |
|
7895 "axis-numeric-base": { |
|
7896 "requires": [ |
|
7897 "axis-base" |
|
7898 ] |
|
7899 }, |
|
7900 "axis-stacked": { |
|
7901 "requires": [ |
|
7902 "axis-numeric", |
|
7903 "axis-stacked-base" |
|
7904 ] |
|
7905 }, |
|
7906 "axis-stacked-base": { |
|
7907 "requires": [ |
|
7908 "axis-numeric-base" |
|
7909 ] |
|
7910 }, |
|
7911 "axis-time": { |
|
7912 "requires": [ |
|
7913 "axis", |
|
7914 "axis-time-base" |
|
7915 ] |
|
7916 }, |
|
7917 "axis-time-base": { |
|
7918 "requires": [ |
|
7919 "axis-base" |
|
7920 ] |
|
7921 }, |
|
7922 "base": { |
|
7923 "use": [ |
|
7924 "base-base", |
|
7925 "base-pluginhost", |
|
7926 "base-build" |
|
7927 ] |
|
7928 }, |
|
7929 "base-base": { |
|
7930 "requires": [ |
|
7931 "attribute-base", |
|
7932 "base-core", |
|
7933 "base-observable" |
|
7934 ] |
|
7935 }, |
|
7936 "base-build": { |
|
7937 "requires": [ |
|
7938 "base-base" |
|
7939 ] |
|
7940 }, |
|
7941 "base-core": { |
|
7942 "requires": [ |
|
7943 "attribute-core" |
|
7944 ] |
|
7945 }, |
|
7946 "base-observable": { |
|
7947 "requires": [ |
|
7948 "attribute-observable" |
|
7949 ] |
|
7950 }, |
|
7951 "base-pluginhost": { |
|
7952 "requires": [ |
|
7953 "base-base", |
|
7954 "pluginhost" |
|
7955 ] |
|
7956 }, |
|
7957 "button": { |
|
7958 "requires": [ |
|
7959 "button-core", |
|
7960 "cssbutton", |
|
7961 "widget" |
|
7962 ] |
|
7963 }, |
|
7964 "button-core": { |
|
7965 "requires": [ |
|
7966 "attribute-core", |
|
7967 "classnamemanager", |
|
7968 "node-base" |
|
7969 ] |
|
7970 }, |
|
7971 "button-group": { |
|
7972 "requires": [ |
|
7973 "button-plugin", |
|
7974 "cssbutton", |
|
7975 "widget" |
|
7976 ] |
|
7977 }, |
|
7978 "button-plugin": { |
|
7979 "requires": [ |
|
7980 "button-core", |
|
7981 "cssbutton", |
|
7982 "node-pluginhost" |
|
7983 ] |
|
7984 }, |
|
7985 "cache": { |
|
7986 "use": [ |
|
7987 "cache-base", |
|
7988 "cache-offline", |
|
7989 "cache-plugin" |
|
7990 ] |
|
7991 }, |
|
7992 "cache-base": { |
|
7993 "requires": [ |
|
7994 "base" |
|
7995 ] |
|
7996 }, |
|
7997 "cache-offline": { |
|
7998 "requires": [ |
|
7999 "cache-base", |
|
8000 "json" |
|
8001 ] |
|
8002 }, |
|
8003 "cache-plugin": { |
|
8004 "requires": [ |
|
8005 "plugin", |
|
8006 "cache-base" |
|
8007 ] |
|
8008 }, |
|
8009 "calendar": { |
|
8010 "lang": [ |
|
8011 "de", |
|
8012 "en", |
|
8013 "es", |
|
8014 "es-AR", |
|
8015 "fr", |
|
8016 "it", |
|
8017 "ja", |
|
8018 "nb-NO", |
|
8019 "nl", |
|
8020 "pt-BR", |
|
8021 "ru", |
|
8022 "zh-HANT-TW" |
|
8023 ], |
|
8024 "requires": [ |
|
8025 "calendar-base", |
|
8026 "calendarnavigator" |
|
8027 ], |
|
8028 "skinnable": true |
|
8029 }, |
|
8030 "calendar-base": { |
|
8031 "lang": [ |
|
8032 "de", |
|
8033 "en", |
|
8034 "es", |
|
8035 "es-AR", |
|
8036 "fr", |
|
8037 "it", |
|
8038 "ja", |
|
8039 "nb-NO", |
|
8040 "nl", |
|
8041 "pt-BR", |
|
8042 "ru", |
|
8043 "zh-HANT-TW" |
|
8044 ], |
|
8045 "requires": [ |
|
8046 "widget", |
|
8047 "datatype-date", |
|
8048 "datatype-date-math", |
|
8049 "cssgrids" |
|
8050 ], |
|
8051 "skinnable": true |
|
8052 }, |
|
8053 "calendarnavigator": { |
|
8054 "requires": [ |
|
8055 "plugin", |
|
8056 "classnamemanager", |
|
8057 "datatype-date", |
|
8058 "node" |
|
8059 ], |
|
8060 "skinnable": true |
|
8061 }, |
|
8062 "charts": { |
|
8063 "use": [ |
|
8064 "charts-base" |
|
8065 ] |
|
8066 }, |
|
8067 "charts-base": { |
|
8068 "requires": [ |
|
8069 "dom", |
|
8070 "event-mouseenter", |
|
8071 "event-touch", |
|
8072 "graphics-group", |
|
8073 "axes", |
|
8074 "series-pie", |
|
8075 "series-line", |
|
8076 "series-marker", |
|
8077 "series-area", |
|
8078 "series-spline", |
|
8079 "series-column", |
|
8080 "series-bar", |
|
8081 "series-areaspline", |
|
8082 "series-combo", |
|
8083 "series-combospline", |
|
8084 "series-line-stacked", |
|
8085 "series-marker-stacked", |
|
8086 "series-area-stacked", |
|
8087 "series-spline-stacked", |
|
8088 "series-column-stacked", |
|
8089 "series-bar-stacked", |
|
8090 "series-areaspline-stacked", |
|
8091 "series-combo-stacked", |
|
8092 "series-combospline-stacked" |
|
8093 ] |
|
8094 }, |
|
8095 "charts-legend": { |
|
8096 "requires": [ |
|
8097 "charts-base" |
|
8098 ] |
|
8099 }, |
|
8100 "classnamemanager": { |
|
8101 "requires": [ |
|
8102 "yui-base" |
|
8103 ] |
|
8104 }, |
|
8105 "clickable-rail": { |
|
8106 "requires": [ |
|
8107 "slider-base" |
|
8108 ] |
|
8109 }, |
|
8110 "collection": { |
|
8111 "use": [ |
|
8112 "array-extras", |
|
8113 "arraylist", |
|
8114 "arraylist-add", |
|
8115 "arraylist-filter", |
|
8116 "array-invoke" |
|
8117 ] |
|
8118 }, |
|
8119 "color": { |
|
8120 "use": [ |
|
8121 "color-base", |
|
8122 "color-hsl", |
|
8123 "color-harmony" |
|
8124 ] |
|
8125 }, |
|
8126 "color-base": { |
|
8127 "requires": [ |
|
8128 "yui-base" |
|
8129 ] |
|
8130 }, |
|
8131 "color-harmony": { |
|
8132 "requires": [ |
|
8133 "color-hsl" |
|
8134 ] |
|
8135 }, |
|
8136 "color-hsl": { |
|
8137 "requires": [ |
|
8138 "color-base" |
|
8139 ] |
|
8140 }, |
|
8141 "color-hsv": { |
|
8142 "requires": [ |
|
8143 "color-base" |
|
8144 ] |
|
8145 }, |
|
8146 "console": { |
|
8147 "lang": [ |
|
8148 "en", |
|
8149 "es", |
|
8150 "it", |
|
8151 "ja" |
|
8152 ], |
|
8153 "requires": [ |
|
8154 "yui-log", |
|
8155 "widget" |
|
8156 ], |
|
8157 "skinnable": true |
|
8158 }, |
|
8159 "console-filters": { |
|
8160 "requires": [ |
|
8161 "plugin", |
|
8162 "console" |
|
8163 ], |
|
8164 "skinnable": true |
|
8165 }, |
|
8166 "controller": { |
|
8167 "use": [ |
|
8168 "router" |
|
8169 ] |
|
8170 }, |
|
8171 "cookie": { |
|
8172 "requires": [ |
|
8173 "yui-base" |
|
8174 ] |
|
8175 }, |
|
8176 "createlink-base": { |
|
8177 "requires": [ |
|
8178 "editor-base" |
|
8179 ] |
|
8180 }, |
|
8181 "cssbase": { |
|
8182 "after": [ |
|
8183 "cssreset", |
|
8184 "cssfonts", |
|
8185 "cssgrids", |
|
8186 "cssreset-context", |
|
8187 "cssfonts-context", |
|
8188 "cssgrids-context" |
|
8189 ], |
|
8190 "type": "css" |
|
8191 }, |
|
8192 "cssbase-context": { |
|
8193 "after": [ |
|
8194 "cssreset", |
|
8195 "cssfonts", |
|
8196 "cssgrids", |
|
8197 "cssreset-context", |
|
8198 "cssfonts-context", |
|
8199 "cssgrids-context" |
|
8200 ], |
|
8201 "type": "css" |
|
8202 }, |
|
8203 "cssbutton": { |
|
8204 "type": "css" |
|
8205 }, |
|
8206 "cssfonts": { |
|
8207 "type": "css" |
|
8208 }, |
|
8209 "cssfonts-context": { |
|
8210 "type": "css" |
|
8211 }, |
|
8212 "cssgrids": { |
|
8213 "optional": [ |
|
8214 "cssreset", |
|
8215 "cssfonts" |
|
8216 ], |
|
8217 "type": "css" |
|
8218 }, |
|
8219 "cssgrids-base": { |
|
8220 "optional": [ |
|
8221 "cssreset", |
|
8222 "cssfonts" |
|
8223 ], |
|
8224 "type": "css" |
|
8225 }, |
|
8226 "cssgrids-responsive": { |
|
8227 "optional": [ |
|
8228 "cssreset", |
|
8229 "cssfonts" |
|
8230 ], |
|
8231 "requires": [ |
|
8232 "cssgrids", |
|
8233 "cssgrids-responsive-base" |
|
8234 ], |
|
8235 "type": "css" |
|
8236 }, |
|
8237 "cssgrids-units": { |
|
8238 "optional": [ |
|
8239 "cssreset", |
|
8240 "cssfonts" |
|
8241 ], |
|
8242 "requires": [ |
|
8243 "cssgrids-base" |
|
8244 ], |
|
8245 "type": "css" |
|
8246 }, |
|
8247 "cssnormalize": { |
|
8248 "type": "css" |
|
8249 }, |
|
8250 "cssnormalize-context": { |
|
8251 "type": "css" |
|
8252 }, |
|
8253 "cssreset": { |
|
8254 "type": "css" |
|
8255 }, |
|
8256 "cssreset-context": { |
|
8257 "type": "css" |
|
8258 }, |
|
8259 "dataschema": { |
|
8260 "use": [ |
|
8261 "dataschema-base", |
|
8262 "dataschema-json", |
|
8263 "dataschema-xml", |
|
8264 "dataschema-array", |
|
8265 "dataschema-text" |
|
8266 ] |
|
8267 }, |
|
8268 "dataschema-array": { |
|
8269 "requires": [ |
|
8270 "dataschema-base" |
|
8271 ] |
|
8272 }, |
|
8273 "dataschema-base": { |
|
8274 "requires": [ |
|
8275 "base" |
|
8276 ] |
|
8277 }, |
|
8278 "dataschema-json": { |
|
8279 "requires": [ |
|
8280 "dataschema-base", |
|
8281 "json" |
|
8282 ] |
|
8283 }, |
|
8284 "dataschema-text": { |
|
8285 "requires": [ |
|
8286 "dataschema-base" |
|
8287 ] |
|
8288 }, |
|
8289 "dataschema-xml": { |
|
8290 "requires": [ |
|
8291 "dataschema-base" |
|
8292 ] |
|
8293 }, |
|
8294 "datasource": { |
|
8295 "use": [ |
|
8296 "datasource-local", |
|
8297 "datasource-io", |
|
8298 "datasource-get", |
|
8299 "datasource-function", |
|
8300 "datasource-cache", |
|
8301 "datasource-jsonschema", |
|
8302 "datasource-xmlschema", |
|
8303 "datasource-arrayschema", |
|
8304 "datasource-textschema", |
|
8305 "datasource-polling" |
|
8306 ] |
|
8307 }, |
|
8308 "datasource-arrayschema": { |
|
8309 "requires": [ |
|
8310 "datasource-local", |
|
8311 "plugin", |
|
8312 "dataschema-array" |
|
8313 ] |
|
8314 }, |
|
8315 "datasource-cache": { |
|
8316 "requires": [ |
|
8317 "datasource-local", |
|
8318 "plugin", |
|
8319 "cache-base" |
|
8320 ] |
|
8321 }, |
|
8322 "datasource-function": { |
|
8323 "requires": [ |
|
8324 "datasource-local" |
|
8325 ] |
|
8326 }, |
|
8327 "datasource-get": { |
|
8328 "requires": [ |
|
8329 "datasource-local", |
|
8330 "get" |
|
8331 ] |
|
8332 }, |
|
8333 "datasource-io": { |
|
8334 "requires": [ |
|
8335 "datasource-local", |
|
8336 "io-base" |
|
8337 ] |
|
8338 }, |
|
8339 "datasource-jsonschema": { |
|
8340 "requires": [ |
|
8341 "datasource-local", |
|
8342 "plugin", |
|
8343 "dataschema-json" |
|
8344 ] |
|
8345 }, |
|
8346 "datasource-local": { |
|
8347 "requires": [ |
|
8348 "base" |
|
8349 ] |
|
8350 }, |
|
8351 "datasource-polling": { |
|
8352 "requires": [ |
|
8353 "datasource-local" |
|
8354 ] |
|
8355 }, |
|
8356 "datasource-textschema": { |
|
8357 "requires": [ |
|
8358 "datasource-local", |
|
8359 "plugin", |
|
8360 "dataschema-text" |
|
8361 ] |
|
8362 }, |
|
8363 "datasource-xmlschema": { |
|
8364 "requires": [ |
|
8365 "datasource-local", |
|
8366 "plugin", |
|
8367 "datatype-xml", |
|
8368 "dataschema-xml" |
|
8369 ] |
|
8370 }, |
|
8371 "datatable": { |
|
8372 "use": [ |
|
8373 "datatable-core", |
|
8374 "datatable-table", |
|
8375 "datatable-head", |
|
8376 "datatable-body", |
|
8377 "datatable-base", |
|
8378 "datatable-column-widths", |
|
8379 "datatable-message", |
|
8380 "datatable-mutable", |
|
8381 "datatable-sort", |
|
8382 "datatable-datasource" |
|
8383 ] |
|
8384 }, |
|
8385 "datatable-base": { |
|
8386 "requires": [ |
|
8387 "datatable-core", |
|
8388 "datatable-table", |
|
8389 "datatable-head", |
|
8390 "datatable-body", |
|
8391 "base-build", |
|
8392 "widget" |
|
8393 ], |
|
8394 "skinnable": true |
|
8395 }, |
|
8396 "datatable-body": { |
|
8397 "requires": [ |
|
8398 "datatable-core", |
|
8399 "view", |
|
8400 "classnamemanager" |
|
8401 ] |
|
8402 }, |
|
8403 "datatable-column-widths": { |
|
8404 "requires": [ |
|
8405 "datatable-base" |
|
8406 ] |
|
8407 }, |
|
8408 "datatable-core": { |
|
8409 "requires": [ |
|
8410 "escape", |
|
8411 "model-list", |
|
8412 "node-event-delegate" |
|
8413 ] |
|
8414 }, |
|
8415 "datatable-datasource": { |
|
8416 "requires": [ |
|
8417 "datatable-base", |
|
8418 "plugin", |
|
8419 "datasource-local" |
|
8420 ] |
|
8421 }, |
|
8422 "datatable-formatters": { |
|
8423 "requires": [ |
|
8424 "datatable-body", |
|
8425 "datatype-number-format", |
|
8426 "datatype-date-format", |
|
8427 "escape" |
|
8428 ] |
|
8429 }, |
|
8430 "datatable-head": { |
|
8431 "requires": [ |
|
8432 "datatable-core", |
|
8433 "view", |
|
8434 "classnamemanager" |
|
8435 ] |
|
8436 }, |
|
8437 "datatable-message": { |
|
8438 "lang": [ |
|
8439 "en", |
|
8440 "fr", |
|
8441 "es", |
|
8442 "it" |
|
8443 ], |
|
8444 "requires": [ |
|
8445 "datatable-base" |
|
8446 ], |
|
8447 "skinnable": true |
|
8448 }, |
|
8449 "datatable-mutable": { |
|
8450 "requires": [ |
|
8451 "datatable-base" |
|
8452 ] |
|
8453 }, |
|
8454 "datatable-scroll": { |
|
8455 "requires": [ |
|
8456 "datatable-base", |
|
8457 "datatable-column-widths", |
|
8458 "dom-screen" |
|
8459 ], |
|
8460 "skinnable": true |
|
8461 }, |
|
8462 "datatable-sort": { |
|
8463 "lang": [ |
|
8464 "en", |
|
8465 "fr", |
|
8466 "es" |
|
8467 ], |
|
8468 "requires": [ |
|
8469 "datatable-base" |
|
8470 ], |
|
8471 "skinnable": true |
|
8472 }, |
|
8473 "datatable-table": { |
|
8474 "requires": [ |
|
8475 "datatable-core", |
|
8476 "datatable-head", |
|
8477 "datatable-body", |
|
8478 "view", |
|
8479 "classnamemanager" |
|
8480 ] |
|
8481 }, |
|
8482 "datatype": { |
|
8483 "use": [ |
|
8484 "datatype-date", |
|
8485 "datatype-number", |
|
8486 "datatype-xml" |
|
8487 ] |
|
8488 }, |
|
8489 "datatype-date": { |
|
8490 "use": [ |
|
8491 "datatype-date-parse", |
|
8492 "datatype-date-format", |
|
8493 "datatype-date-math" |
|
8494 ] |
|
8495 }, |
|
8496 "datatype-date-format": { |
|
8497 "lang": [ |
|
8498 "ar", |
|
8499 "ar-JO", |
|
8500 "ca", |
|
8501 "ca-ES", |
|
8502 "da", |
|
8503 "da-DK", |
|
8504 "de", |
|
8505 "de-AT", |
|
8506 "de-DE", |
|
8507 "el", |
|
8508 "el-GR", |
|
8509 "en", |
|
8510 "en-AU", |
|
8511 "en-CA", |
|
8512 "en-GB", |
|
8513 "en-IE", |
|
8514 "en-IN", |
|
8515 "en-JO", |
|
8516 "en-MY", |
|
8517 "en-NZ", |
|
8518 "en-PH", |
|
8519 "en-SG", |
|
8520 "en-US", |
|
8521 "es", |
|
8522 "es-AR", |
|
8523 "es-BO", |
|
8524 "es-CL", |
|
8525 "es-CO", |
|
8526 "es-EC", |
|
8527 "es-ES", |
|
8528 "es-MX", |
|
8529 "es-PE", |
|
8530 "es-PY", |
|
8531 "es-US", |
|
8532 "es-UY", |
|
8533 "es-VE", |
|
8534 "fi", |
|
8535 "fi-FI", |
|
8536 "fr", |
|
8537 "fr-BE", |
|
8538 "fr-CA", |
|
8539 "fr-FR", |
|
8540 "hi", |
|
8541 "hi-IN", |
|
8542 "id", |
|
8543 "id-ID", |
|
8544 "it", |
|
8545 "it-IT", |
|
8546 "ja", |
|
8547 "ja-JP", |
|
8548 "ko", |
|
8549 "ko-KR", |
|
8550 "ms", |
|
8551 "ms-MY", |
|
8552 "nb", |
|
8553 "nb-NO", |
|
8554 "nl", |
|
8555 "nl-BE", |
|
8556 "nl-NL", |
|
8557 "pl", |
|
8558 "pl-PL", |
|
8559 "pt", |
|
8560 "pt-BR", |
|
8561 "ro", |
|
8562 "ro-RO", |
|
8563 "ru", |
|
8564 "ru-RU", |
|
8565 "sv", |
|
8566 "sv-SE", |
|
8567 "th", |
|
8568 "th-TH", |
|
8569 "tr", |
|
8570 "tr-TR", |
|
8571 "vi", |
|
8572 "vi-VN", |
|
8573 "zh-Hans", |
|
8574 "zh-Hans-CN", |
|
8575 "zh-Hant", |
|
8576 "zh-Hant-HK", |
|
8577 "zh-Hant-TW" |
|
8578 ] |
|
8579 }, |
|
8580 "datatype-date-math": { |
|
8581 "requires": [ |
|
8582 "yui-base" |
|
8583 ] |
|
8584 }, |
|
8585 "datatype-date-parse": {}, |
|
8586 "datatype-number": { |
|
8587 "use": [ |
|
8588 "datatype-number-parse", |
|
8589 "datatype-number-format" |
|
8590 ] |
|
8591 }, |
|
8592 "datatype-number-format": {}, |
|
8593 "datatype-number-parse": {}, |
|
8594 "datatype-xml": { |
|
8595 "use": [ |
|
8596 "datatype-xml-parse", |
|
8597 "datatype-xml-format" |
|
8598 ] |
|
8599 }, |
|
8600 "datatype-xml-format": {}, |
|
8601 "datatype-xml-parse": {}, |
|
8602 "dd": { |
|
8603 "use": [ |
|
8604 "dd-ddm-base", |
|
8605 "dd-ddm", |
|
8606 "dd-ddm-drop", |
|
8607 "dd-drag", |
|
8608 "dd-proxy", |
|
8609 "dd-constrain", |
|
8610 "dd-drop", |
|
8611 "dd-scroll", |
|
8612 "dd-delegate" |
|
8613 ] |
|
8614 }, |
|
8615 "dd-constrain": { |
|
8616 "requires": [ |
|
8617 "dd-drag" |
|
8618 ] |
|
8619 }, |
|
8620 "dd-ddm": { |
|
8621 "requires": [ |
|
8622 "dd-ddm-base", |
|
8623 "event-resize" |
|
8624 ] |
|
8625 }, |
|
8626 "dd-ddm-base": { |
|
8627 "requires": [ |
|
8628 "node", |
|
8629 "base", |
|
8630 "yui-throttle", |
|
8631 "classnamemanager" |
|
8632 ] |
|
8633 }, |
|
8634 "dd-ddm-drop": { |
|
8635 "requires": [ |
|
8636 "dd-ddm" |
|
8637 ] |
|
8638 }, |
|
8639 "dd-delegate": { |
|
8640 "requires": [ |
|
8641 "dd-drag", |
|
8642 "dd-drop-plugin", |
|
8643 "event-mouseenter" |
|
8644 ] |
|
8645 }, |
|
8646 "dd-drag": { |
|
8647 "requires": [ |
|
8648 "dd-ddm-base" |
|
8649 ] |
|
8650 }, |
|
8651 "dd-drop": { |
|
8652 "requires": [ |
|
8653 "dd-drag", |
|
8654 "dd-ddm-drop" |
|
8655 ] |
|
8656 }, |
|
8657 "dd-drop-plugin": { |
|
8658 "requires": [ |
|
8659 "dd-drop" |
|
8660 ] |
|
8661 }, |
|
8662 "dd-gestures": { |
|
8663 "condition": { |
|
8664 "name": "dd-gestures", |
|
8665 "trigger": "dd-drag", |
|
8666 "ua": "touchEnabled" |
|
8667 }, |
|
8668 "requires": [ |
|
8669 "dd-drag", |
|
8670 "event-synthetic", |
|
8671 "event-gestures" |
|
8672 ] |
|
8673 }, |
|
8674 "dd-plugin": { |
|
8675 "optional": [ |
|
8676 "dd-constrain", |
|
8677 "dd-proxy" |
|
8678 ], |
|
8679 "requires": [ |
|
8680 "dd-drag" |
|
8681 ] |
|
8682 }, |
|
8683 "dd-proxy": { |
|
8684 "requires": [ |
|
8685 "dd-drag" |
|
8686 ] |
|
8687 }, |
|
8688 "dd-scroll": { |
|
8689 "requires": [ |
|
8690 "dd-drag" |
|
8691 ] |
|
8692 }, |
|
8693 "dial": { |
|
8694 "lang": [ |
|
8695 "en", |
|
8696 "es" |
|
8697 ], |
|
8698 "requires": [ |
|
8699 "widget", |
|
8700 "dd-drag", |
|
8701 "event-mouseenter", |
|
8702 "event-move", |
|
8703 "event-key", |
|
8704 "transition", |
|
8705 "intl" |
|
8706 ], |
|
8707 "skinnable": true |
|
8708 }, |
|
8709 "dom": { |
|
8710 "use": [ |
|
8711 "dom-base", |
|
8712 "dom-screen", |
|
8713 "dom-style", |
|
8714 "selector-native", |
|
8715 "selector" |
|
8716 ] |
|
8717 }, |
|
8718 "dom-base": { |
|
8719 "requires": [ |
|
8720 "dom-core" |
|
8721 ] |
|
8722 }, |
|
8723 "dom-core": { |
|
8724 "requires": [ |
|
8725 "oop", |
|
8726 "features" |
|
8727 ] |
|
8728 }, |
|
8729 "dom-deprecated": { |
|
8730 "requires": [ |
|
8731 "dom-base" |
|
8732 ] |
|
8733 }, |
|
8734 "dom-screen": { |
|
8735 "requires": [ |
|
8736 "dom-base", |
|
8737 "dom-style" |
|
8738 ] |
|
8739 }, |
|
8740 "dom-style": { |
|
8741 "requires": [ |
|
8742 "dom-base", |
|
8743 "color-base" |
|
8744 ] |
|
8745 }, |
|
8746 "dom-style-ie": { |
|
8747 "condition": { |
|
8748 "name": "dom-style-ie", |
|
8749 "test": function (Y) { |
|
8750 |
|
8751 var testFeature = Y.Features.test, |
|
8752 addFeature = Y.Features.add, |
|
8753 WINDOW = Y.config.win, |
|
8754 DOCUMENT = Y.config.doc, |
|
8755 DOCUMENT_ELEMENT = 'documentElement', |
|
8756 ret = false; |
|
8757 |
|
8758 addFeature('style', 'computedStyle', { |
|
8759 test: function() { |
|
8760 return WINDOW && 'getComputedStyle' in WINDOW; |
|
8761 } |
|
8762 }); |
|
8763 |
|
8764 addFeature('style', 'opacity', { |
|
8765 test: function() { |
|
8766 return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style; |
|
8767 } |
|
8768 }); |
|
8769 |
|
8770 ret = (!testFeature('style', 'opacity') && |
|
8771 !testFeature('style', 'computedStyle')); |
|
8772 |
|
8773 return ret; |
|
8774 }, |
|
8775 "trigger": "dom-style" |
|
8776 }, |
|
8777 "requires": [ |
|
8778 "dom-style" |
|
8779 ] |
|
8780 }, |
|
8781 "dump": { |
|
8782 "requires": [ |
|
8783 "yui-base" |
|
8784 ] |
|
8785 }, |
|
8786 "editor": { |
|
8787 "use": [ |
|
8788 "frame", |
|
8789 "editor-selection", |
|
8790 "exec-command", |
|
8791 "editor-base", |
|
8792 "editor-para", |
|
8793 "editor-br", |
|
8794 "editor-bidi", |
|
8795 "editor-tab", |
|
8796 "createlink-base" |
|
8797 ] |
|
8798 }, |
|
8799 "editor-base": { |
|
8800 "requires": [ |
|
8801 "base", |
|
8802 "frame", |
|
8803 "node", |
|
8804 "exec-command", |
|
8805 "editor-selection" |
|
8806 ] |
|
8807 }, |
|
8808 "editor-bidi": { |
|
8809 "requires": [ |
|
8810 "editor-base" |
|
8811 ] |
|
8812 }, |
|
8813 "editor-br": { |
|
8814 "requires": [ |
|
8815 "editor-base" |
|
8816 ] |
|
8817 }, |
|
8818 "editor-lists": { |
|
8819 "requires": [ |
|
8820 "editor-base" |
|
8821 ] |
|
8822 }, |
|
8823 "editor-para": { |
|
8824 "requires": [ |
|
8825 "editor-para-base" |
|
8826 ] |
|
8827 }, |
|
8828 "editor-para-base": { |
|
8829 "requires": [ |
|
8830 "editor-base" |
|
8831 ] |
|
8832 }, |
|
8833 "editor-para-ie": { |
|
8834 "condition": { |
|
8835 "name": "editor-para-ie", |
|
8836 "trigger": "editor-para", |
|
8837 "ua": "ie", |
|
8838 "when": "instead" |
|
8839 }, |
|
8840 "requires": [ |
|
8841 "editor-para-base" |
|
8842 ] |
|
8843 }, |
|
8844 "editor-selection": { |
|
8845 "requires": [ |
|
8846 "node" |
|
8847 ] |
|
8848 }, |
|
8849 "editor-tab": { |
|
8850 "requires": [ |
|
8851 "editor-base" |
|
8852 ] |
|
8853 }, |
|
8854 "escape": { |
|
8855 "requires": [ |
|
8856 "yui-base" |
|
8857 ] |
|
8858 }, |
|
8859 "event": { |
|
8860 "after": [ |
|
8861 "node-base" |
|
8862 ], |
|
8863 "use": [ |
|
8864 "event-base", |
|
8865 "event-delegate", |
|
8866 "event-synthetic", |
|
8867 "event-mousewheel", |
|
8868 "event-mouseenter", |
|
8869 "event-key", |
|
8870 "event-focus", |
|
8871 "event-resize", |
|
8872 "event-hover", |
|
8873 "event-outside", |
|
8874 "event-touch", |
|
8875 "event-move", |
|
8876 "event-flick", |
|
8877 "event-valuechange", |
|
8878 "event-tap" |
|
8879 ] |
|
8880 }, |
|
8881 "event-base": { |
|
8882 "after": [ |
|
8883 "node-base" |
|
8884 ], |
|
8885 "requires": [ |
|
8886 "event-custom-base" |
|
8887 ] |
|
8888 }, |
|
8889 "event-base-ie": { |
|
8890 "after": [ |
|
8891 "event-base" |
|
8892 ], |
|
8893 "condition": { |
|
8894 "name": "event-base-ie", |
|
8895 "test": function(Y) { |
|
8896 var imp = Y.config.doc && Y.config.doc.implementation; |
|
8897 return (imp && (!imp.hasFeature('Events', '2.0'))); |
|
8898 }, |
|
8899 "trigger": "node-base" |
|
8900 }, |
|
8901 "requires": [ |
|
8902 "node-base" |
|
8903 ] |
|
8904 }, |
|
8905 "event-contextmenu": { |
|
8906 "requires": [ |
|
8907 "event-synthetic", |
|
8908 "dom-screen" |
|
8909 ] |
|
8910 }, |
|
8911 "event-custom": { |
|
8912 "use": [ |
|
8913 "event-custom-base", |
|
8914 "event-custom-complex" |
|
8915 ] |
|
8916 }, |
|
8917 "event-custom-base": { |
|
8918 "requires": [ |
|
8919 "oop" |
|
8920 ] |
|
8921 }, |
|
8922 "event-custom-complex": { |
|
8923 "requires": [ |
|
8924 "event-custom-base" |
|
8925 ] |
|
8926 }, |
|
8927 "event-delegate": { |
|
8928 "requires": [ |
|
8929 "node-base" |
|
8930 ] |
|
8931 }, |
|
8932 "event-flick": { |
|
8933 "requires": [ |
|
8934 "node-base", |
|
8935 "event-touch", |
|
8936 "event-synthetic" |
|
8937 ] |
|
8938 }, |
|
8939 "event-focus": { |
|
8940 "requires": [ |
|
8941 "event-synthetic" |
|
8942 ] |
|
8943 }, |
|
8944 "event-gestures": { |
|
8945 "use": [ |
|
8946 "event-flick", |
|
8947 "event-move" |
|
8948 ] |
|
8949 }, |
|
8950 "event-hover": { |
|
8951 "requires": [ |
|
8952 "event-mouseenter" |
|
8953 ] |
|
8954 }, |
|
8955 "event-key": { |
|
8956 "requires": [ |
|
8957 "event-synthetic" |
|
8958 ] |
|
8959 }, |
|
8960 "event-mouseenter": { |
|
8961 "requires": [ |
|
8962 "event-synthetic" |
|
8963 ] |
|
8964 }, |
|
8965 "event-mousewheel": { |
|
8966 "requires": [ |
|
8967 "node-base" |
|
8968 ] |
|
8969 }, |
|
8970 "event-move": { |
|
8971 "requires": [ |
|
8972 "node-base", |
|
8973 "event-touch", |
|
8974 "event-synthetic" |
|
8975 ] |
|
8976 }, |
|
8977 "event-outside": { |
|
8978 "requires": [ |
|
8979 "event-synthetic" |
|
8980 ] |
|
8981 }, |
|
8982 "event-resize": { |
|
8983 "requires": [ |
|
8984 "node-base", |
|
8985 "event-synthetic" |
|
8986 ] |
|
8987 }, |
|
8988 "event-simulate": { |
|
8989 "requires": [ |
|
8990 "event-base" |
|
8991 ] |
|
8992 }, |
|
8993 "event-synthetic": { |
|
8994 "requires": [ |
|
8995 "node-base", |
|
8996 "event-custom-complex" |
|
8997 ] |
|
8998 }, |
|
8999 "event-tap": { |
|
9000 "requires": [ |
|
9001 "node-base", |
|
9002 "event-base", |
|
9003 "event-touch", |
|
9004 "event-synthetic" |
|
9005 ] |
|
9006 }, |
|
9007 "event-touch": { |
|
9008 "requires": [ |
|
9009 "node-base" |
|
9010 ] |
|
9011 }, |
|
9012 "event-valuechange": { |
|
9013 "requires": [ |
|
9014 "event-focus", |
|
9015 "event-synthetic" |
|
9016 ] |
|
9017 }, |
|
9018 "exec-command": { |
|
9019 "requires": [ |
|
9020 "frame" |
|
9021 ] |
|
9022 }, |
|
9023 "features": { |
|
9024 "requires": [ |
|
9025 "yui-base" |
|
9026 ] |
|
9027 }, |
|
9028 "file": { |
|
9029 "requires": [ |
|
9030 "file-flash", |
|
9031 "file-html5" |
|
9032 ] |
|
9033 }, |
|
9034 "file-flash": { |
|
9035 "requires": [ |
|
9036 "base" |
|
9037 ] |
|
9038 }, |
|
9039 "file-html5": { |
|
9040 "requires": [ |
|
9041 "base" |
|
9042 ] |
|
9043 }, |
|
9044 "frame": { |
|
9045 "requires": [ |
|
9046 "base", |
|
9047 "node", |
|
9048 "selector-css3", |
|
9049 "yui-throttle" |
|
9050 ] |
|
9051 }, |
|
9052 "gesture-simulate": { |
|
9053 "requires": [ |
|
9054 "async-queue", |
|
9055 "event-simulate", |
|
9056 "node-screen" |
|
9057 ] |
|
9058 }, |
|
9059 "get": { |
|
9060 "requires": [ |
|
9061 "yui-base" |
|
9062 ] |
|
9063 }, |
|
9064 "graphics": { |
|
9065 "requires": [ |
|
9066 "node", |
|
9067 "event-custom", |
|
9068 "pluginhost", |
|
9069 "matrix", |
|
9070 "classnamemanager" |
|
9071 ] |
|
9072 }, |
|
9073 "graphics-canvas": { |
|
9074 "condition": { |
|
9075 "name": "graphics-canvas", |
|
9076 "test": function(Y) { |
|
9077 var DOCUMENT = Y.config.doc, |
|
9078 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", |
|
9079 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), |
|
9080 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); |
|
9081 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); |
|
9082 }, |
|
9083 "trigger": "graphics" |
|
9084 }, |
|
9085 "requires": [ |
|
9086 "graphics" |
|
9087 ] |
|
9088 }, |
|
9089 "graphics-canvas-default": { |
|
9090 "condition": { |
|
9091 "name": "graphics-canvas-default", |
|
9092 "test": function(Y) { |
|
9093 var DOCUMENT = Y.config.doc, |
|
9094 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", |
|
9095 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), |
|
9096 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); |
|
9097 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); |
|
9098 }, |
|
9099 "trigger": "graphics" |
|
9100 } |
|
9101 }, |
|
9102 "graphics-group": { |
|
9103 "requires": [ |
|
9104 "graphics" |
|
9105 ] |
|
9106 }, |
|
9107 "graphics-svg": { |
|
9108 "condition": { |
|
9109 "name": "graphics-svg", |
|
9110 "test": function(Y) { |
|
9111 var DOCUMENT = Y.config.doc, |
|
9112 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", |
|
9113 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), |
|
9114 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); |
|
9115 |
|
9116 return svg && (useSVG || !canvas); |
|
9117 }, |
|
9118 "trigger": "graphics" |
|
9119 }, |
|
9120 "requires": [ |
|
9121 "graphics" |
|
9122 ] |
|
9123 }, |
|
9124 "graphics-svg-default": { |
|
9125 "condition": { |
|
9126 "name": "graphics-svg-default", |
|
9127 "test": function(Y) { |
|
9128 var DOCUMENT = Y.config.doc, |
|
9129 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", |
|
9130 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), |
|
9131 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); |
|
9132 |
|
9133 return svg && (useSVG || !canvas); |
|
9134 }, |
|
9135 "trigger": "graphics" |
|
9136 } |
|
9137 }, |
|
9138 "graphics-vml": { |
|
9139 "condition": { |
|
9140 "name": "graphics-vml", |
|
9141 "test": function(Y) { |
|
9142 var DOCUMENT = Y.config.doc, |
|
9143 canvas = DOCUMENT && DOCUMENT.createElement("canvas"); |
|
9144 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); |
|
9145 }, |
|
9146 "trigger": "graphics" |
|
9147 }, |
|
9148 "requires": [ |
|
9149 "graphics" |
|
9150 ] |
|
9151 }, |
|
9152 "graphics-vml-default": { |
|
9153 "condition": { |
|
9154 "name": "graphics-vml-default", |
|
9155 "test": function(Y) { |
|
9156 var DOCUMENT = Y.config.doc, |
|
9157 canvas = DOCUMENT && DOCUMENT.createElement("canvas"); |
|
9158 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); |
|
9159 }, |
|
9160 "trigger": "graphics" |
|
9161 } |
|
9162 }, |
|
9163 "handlebars": { |
|
9164 "use": [ |
|
9165 "handlebars-compiler" |
|
9166 ] |
|
9167 }, |
|
9168 "handlebars-base": { |
|
9169 "requires": [] |
|
9170 }, |
|
9171 "handlebars-compiler": { |
|
9172 "requires": [ |
|
9173 "handlebars-base" |
|
9174 ] |
|
9175 }, |
|
9176 "highlight": { |
|
9177 "use": [ |
|
9178 "highlight-base", |
|
9179 "highlight-accentfold" |
|
9180 ] |
|
9181 }, |
|
9182 "highlight-accentfold": { |
|
9183 "requires": [ |
|
9184 "highlight-base", |
|
9185 "text-accentfold" |
|
9186 ] |
|
9187 }, |
|
9188 "highlight-base": { |
|
9189 "requires": [ |
|
9190 "array-extras", |
|
9191 "classnamemanager", |
|
9192 "escape", |
|
9193 "text-wordbreak" |
|
9194 ] |
|
9195 }, |
|
9196 "history": { |
|
9197 "use": [ |
|
9198 "history-base", |
|
9199 "history-hash", |
|
9200 "history-hash-ie", |
|
9201 "history-html5" |
|
9202 ] |
|
9203 }, |
|
9204 "history-base": { |
|
9205 "requires": [ |
|
9206 "event-custom-complex" |
|
9207 ] |
|
9208 }, |
|
9209 "history-hash": { |
|
9210 "after": [ |
|
9211 "history-html5" |
|
9212 ], |
|
9213 "requires": [ |
|
9214 "event-synthetic", |
|
9215 "history-base", |
|
9216 "yui-later" |
|
9217 ] |
|
9218 }, |
|
9219 "history-hash-ie": { |
|
9220 "condition": { |
|
9221 "name": "history-hash-ie", |
|
9222 "test": function (Y) { |
|
9223 var docMode = Y.config.doc && Y.config.doc.documentMode; |
|
9224 |
|
9225 return Y.UA.ie && (!('onhashchange' in Y.config.win) || |
|
9226 !docMode || docMode < 8); |
|
9227 }, |
|
9228 "trigger": "history-hash" |
|
9229 }, |
|
9230 "requires": [ |
|
9231 "history-hash", |
|
9232 "node-base" |
|
9233 ] |
|
9234 }, |
|
9235 "history-html5": { |
|
9236 "optional": [ |
|
9237 "json" |
|
9238 ], |
|
9239 "requires": [ |
|
9240 "event-base", |
|
9241 "history-base", |
|
9242 "node-base" |
|
9243 ] |
|
9244 }, |
|
9245 "imageloader": { |
|
9246 "requires": [ |
|
9247 "base-base", |
|
9248 "node-style", |
|
9249 "node-screen" |
|
9250 ] |
|
9251 }, |
|
9252 "intl": { |
|
9253 "requires": [ |
|
9254 "intl-base", |
|
9255 "event-custom" |
|
9256 ] |
|
9257 }, |
|
9258 "intl-base": { |
|
9259 "requires": [ |
|
9260 "yui-base" |
|
9261 ] |
|
9262 }, |
|
9263 "io": { |
|
9264 "use": [ |
|
9265 "io-base", |
|
9266 "io-xdr", |
|
9267 "io-form", |
|
9268 "io-upload-iframe", |
|
9269 "io-queue" |
|
9270 ] |
|
9271 }, |
|
9272 "io-base": { |
|
9273 "requires": [ |
|
9274 "event-custom-base", |
|
9275 "querystring-stringify-simple" |
|
9276 ] |
|
9277 }, |
|
9278 "io-form": { |
|
9279 "requires": [ |
|
9280 "io-base", |
|
9281 "node-base" |
|
9282 ] |
|
9283 }, |
|
9284 "io-nodejs": { |
|
9285 "condition": { |
|
9286 "name": "io-nodejs", |
|
9287 "trigger": "io-base", |
|
9288 "ua": "nodejs" |
|
9289 }, |
|
9290 "requires": [ |
|
9291 "io-base" |
|
9292 ] |
|
9293 }, |
|
9294 "io-queue": { |
|
9295 "requires": [ |
|
9296 "io-base", |
|
9297 "queue-promote" |
|
9298 ] |
|
9299 }, |
|
9300 "io-upload-iframe": { |
|
9301 "requires": [ |
|
9302 "io-base", |
|
9303 "node-base" |
|
9304 ] |
|
9305 }, |
|
9306 "io-xdr": { |
|
9307 "requires": [ |
|
9308 "io-base", |
|
9309 "datatype-xml-parse" |
|
9310 ] |
|
9311 }, |
|
9312 "json": { |
|
9313 "use": [ |
|
9314 "json-parse", |
|
9315 "json-stringify" |
|
9316 ] |
|
9317 }, |
|
9318 "json-parse": { |
|
9319 "requires": [ |
|
9320 "yui-base" |
|
9321 ] |
|
9322 }, |
|
9323 "json-parse-shim": { |
|
9324 "condition": { |
|
9325 "name": "json-parse-shim", |
|
9326 "test": function (Y) { |
|
9327 var _JSON = Y.config.global.JSON, |
|
9328 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, |
|
9329 nativeSupport = Y.config.useNativeJSONParse !== false && !!Native; |
|
9330 |
|
9331 function workingNative( k, v ) { |
|
9332 return k === "ok" ? true : v; |
|
9333 } |
|
9334 |
|
9335 // Double check basic functionality. This is mainly to catch early broken |
|
9336 // implementations of the JSON API in Firefox 3.1 beta1 and beta2 |
|
9337 if ( nativeSupport ) { |
|
9338 try { |
|
9339 nativeSupport = ( Native.parse( '{"ok":false}', workingNative ) ).ok; |
|
9340 } |
|
9341 catch ( e ) { |
|
9342 nativeSupport = false; |
|
9343 } |
|
9344 } |
|
9345 |
|
9346 return !nativeSupport; |
|
9347 }, |
|
9348 "trigger": "json-parse" |
|
9349 }, |
|
9350 "requires": [ |
|
9351 "json-parse" |
|
9352 ] |
|
9353 }, |
|
9354 "json-stringify": { |
|
9355 "requires": [ |
|
9356 "yui-base" |
|
9357 ] |
|
9358 }, |
|
9359 "json-stringify-shim": { |
|
9360 "condition": { |
|
9361 "name": "json-stringify-shim", |
|
9362 "test": function (Y) { |
|
9363 var _JSON = Y.config.global.JSON, |
|
9364 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, |
|
9365 nativeSupport = Y.config.useNativeJSONStringify !== false && !!Native; |
|
9366 |
|
9367 // Double check basic native functionality. This is primarily to catch broken |
|
9368 // early JSON API implementations in Firefox 3.1 beta1 and beta2. |
|
9369 if ( nativeSupport ) { |
|
9370 try { |
|
9371 nativeSupport = ( '0' === Native.stringify(0) ); |
|
9372 } catch ( e ) { |
|
9373 nativeSupport = false; |
|
9374 } |
|
9375 } |
|
9376 |
|
9377 |
|
9378 return !nativeSupport; |
|
9379 }, |
|
9380 "trigger": "json-stringify" |
|
9381 }, |
|
9382 "requires": [ |
|
9383 "json-stringify" |
|
9384 ] |
|
9385 }, |
|
9386 "jsonp": { |
|
9387 "requires": [ |
|
9388 "get", |
|
9389 "oop" |
|
9390 ] |
|
9391 }, |
|
9392 "jsonp-url": { |
|
9393 "requires": [ |
|
9394 "jsonp" |
|
9395 ] |
|
9396 }, |
|
9397 "lazy-model-list": { |
|
9398 "requires": [ |
|
9399 "model-list" |
|
9400 ] |
|
9401 }, |
|
9402 "loader": { |
|
9403 "use": [ |
|
9404 "loader-base", |
|
9405 "loader-rollup", |
|
9406 "loader-yui3" |
|
9407 ] |
|
9408 }, |
|
9409 "loader-base": { |
|
9410 "requires": [ |
|
9411 "get", |
|
9412 "features" |
|
9413 ] |
|
9414 }, |
|
9415 "loader-rollup": { |
|
9416 "requires": [ |
|
9417 "loader-base" |
|
9418 ] |
|
9419 }, |
|
9420 "loader-yui3": { |
|
9421 "requires": [ |
|
9422 "loader-base" |
|
9423 ] |
|
9424 }, |
|
9425 "matrix": { |
|
9426 "requires": [ |
|
9427 "yui-base" |
|
9428 ] |
|
9429 }, |
|
9430 "model": { |
|
9431 "requires": [ |
|
9432 "base-build", |
|
9433 "escape", |
|
9434 "json-parse" |
|
9435 ] |
|
9436 }, |
|
9437 "model-list": { |
|
9438 "requires": [ |
|
9439 "array-extras", |
|
9440 "array-invoke", |
|
9441 "arraylist", |
|
9442 "base-build", |
|
9443 "escape", |
|
9444 "json-parse", |
|
9445 "model" |
|
9446 ] |
|
9447 }, |
|
9448 "model-sync-rest": { |
|
9449 "requires": [ |
|
9450 "model", |
|
9451 "io-base", |
|
9452 "json-stringify" |
|
9453 ] |
|
9454 }, |
|
9455 "node": { |
|
9456 "use": [ |
|
9457 "node-base", |
|
9458 "node-event-delegate", |
|
9459 "node-pluginhost", |
|
9460 "node-screen", |
|
9461 "node-style" |
|
9462 ] |
|
9463 }, |
|
9464 "node-base": { |
|
9465 "requires": [ |
|
9466 "event-base", |
|
9467 "node-core", |
|
9468 "dom-base" |
|
9469 ] |
|
9470 }, |
|
9471 "node-core": { |
|
9472 "requires": [ |
|
9473 "dom-core", |
|
9474 "selector" |
|
9475 ] |
|
9476 }, |
|
9477 "node-deprecated": { |
|
9478 "requires": [ |
|
9479 "node-base" |
|
9480 ] |
|
9481 }, |
|
9482 "node-event-delegate": { |
|
9483 "requires": [ |
|
9484 "node-base", |
|
9485 "event-delegate" |
|
9486 ] |
|
9487 }, |
|
9488 "node-event-html5": { |
|
9489 "requires": [ |
|
9490 "node-base" |
|
9491 ] |
|
9492 }, |
|
9493 "node-event-simulate": { |
|
9494 "requires": [ |
|
9495 "node-base", |
|
9496 "event-simulate", |
|
9497 "gesture-simulate" |
|
9498 ] |
|
9499 }, |
|
9500 "node-flick": { |
|
9501 "requires": [ |
|
9502 "classnamemanager", |
|
9503 "transition", |
|
9504 "event-flick", |
|
9505 "plugin" |
|
9506 ], |
|
9507 "skinnable": true |
|
9508 }, |
|
9509 "node-focusmanager": { |
|
9510 "requires": [ |
|
9511 "attribute", |
|
9512 "node", |
|
9513 "plugin", |
|
9514 "node-event-simulate", |
|
9515 "event-key", |
|
9516 "event-focus" |
|
9517 ] |
|
9518 }, |
|
9519 "node-load": { |
|
9520 "requires": [ |
|
9521 "node-base", |
|
9522 "io-base" |
|
9523 ] |
|
9524 }, |
|
9525 "node-menunav": { |
|
9526 "requires": [ |
|
9527 "node", |
|
9528 "classnamemanager", |
|
9529 "plugin", |
|
9530 "node-focusmanager" |
|
9531 ], |
|
9532 "skinnable": true |
|
9533 }, |
|
9534 "node-pluginhost": { |
|
9535 "requires": [ |
|
9536 "node-base", |
|
9537 "pluginhost" |
|
9538 ] |
|
9539 }, |
|
9540 "node-screen": { |
|
9541 "requires": [ |
|
9542 "dom-screen", |
|
9543 "node-base" |
|
9544 ] |
|
9545 }, |
|
9546 "node-scroll-info": { |
|
9547 "requires": [ |
|
9548 "base-build", |
|
9549 "dom-screen", |
|
9550 "event-resize", |
|
9551 "node-pluginhost", |
|
9552 "plugin" |
|
9553 ] |
|
9554 }, |
|
9555 "node-style": { |
|
9556 "requires": [ |
|
9557 "dom-style", |
|
9558 "node-base" |
|
9559 ] |
|
9560 }, |
|
9561 "oop": { |
|
9562 "requires": [ |
|
9563 "yui-base" |
|
9564 ] |
|
9565 }, |
|
9566 "overlay": { |
|
9567 "requires": [ |
|
9568 "widget", |
|
9569 "widget-stdmod", |
|
9570 "widget-position", |
|
9571 "widget-position-align", |
|
9572 "widget-stack", |
|
9573 "widget-position-constrain" |
|
9574 ], |
|
9575 "skinnable": true |
|
9576 }, |
|
9577 "panel": { |
|
9578 "requires": [ |
|
9579 "widget", |
|
9580 "widget-autohide", |
|
9581 "widget-buttons", |
|
9582 "widget-modality", |
|
9583 "widget-position", |
|
9584 "widget-position-align", |
|
9585 "widget-position-constrain", |
|
9586 "widget-stack", |
|
9587 "widget-stdmod" |
|
9588 ], |
|
9589 "skinnable": true |
|
9590 }, |
|
9591 "parallel": { |
|
9592 "requires": [ |
|
9593 "yui-base" |
|
9594 ] |
|
9595 }, |
|
9596 "pjax": { |
|
9597 "requires": [ |
|
9598 "pjax-base", |
|
9599 "pjax-content" |
|
9600 ] |
|
9601 }, |
|
9602 "pjax-base": { |
|
9603 "requires": [ |
|
9604 "classnamemanager", |
|
9605 "node-event-delegate", |
|
9606 "router" |
|
9607 ] |
|
9608 }, |
|
9609 "pjax-content": { |
|
9610 "requires": [ |
|
9611 "io-base", |
|
9612 "node-base", |
|
9613 "router" |
|
9614 ] |
|
9615 }, |
|
9616 "pjax-plugin": { |
|
9617 "requires": [ |
|
9618 "node-pluginhost", |
|
9619 "pjax", |
|
9620 "plugin" |
|
9621 ] |
|
9622 }, |
|
9623 "plugin": { |
|
9624 "requires": [ |
|
9625 "base-base" |
|
9626 ] |
|
9627 }, |
|
9628 "pluginhost": { |
|
9629 "use": [ |
|
9630 "pluginhost-base", |
|
9631 "pluginhost-config" |
|
9632 ] |
|
9633 }, |
|
9634 "pluginhost-base": { |
|
9635 "requires": [ |
|
9636 "yui-base" |
|
9637 ] |
|
9638 }, |
|
9639 "pluginhost-config": { |
|
9640 "requires": [ |
|
9641 "pluginhost-base" |
|
9642 ] |
|
9643 }, |
|
9644 "promise": { |
|
9645 "requires": [ |
|
9646 "timers" |
|
9647 ] |
|
9648 }, |
|
9649 "querystring": { |
|
9650 "use": [ |
|
9651 "querystring-parse", |
|
9652 "querystring-stringify" |
|
9653 ] |
|
9654 }, |
|
9655 "querystring-parse": { |
|
9656 "requires": [ |
|
9657 "yui-base", |
|
9658 "array-extras" |
|
9659 ] |
|
9660 }, |
|
9661 "querystring-parse-simple": { |
|
9662 "requires": [ |
|
9663 "yui-base" |
|
9664 ] |
|
9665 }, |
|
9666 "querystring-stringify": { |
|
9667 "requires": [ |
|
9668 "yui-base" |
|
9669 ] |
|
9670 }, |
|
9671 "querystring-stringify-simple": { |
|
9672 "requires": [ |
|
9673 "yui-base" |
|
9674 ] |
|
9675 }, |
|
9676 "queue-promote": { |
|
9677 "requires": [ |
|
9678 "yui-base" |
|
9679 ] |
|
9680 }, |
|
9681 "range-slider": { |
|
9682 "requires": [ |
|
9683 "slider-base", |
|
9684 "slider-value-range", |
|
9685 "clickable-rail" |
|
9686 ] |
|
9687 }, |
|
9688 "recordset": { |
|
9689 "use": [ |
|
9690 "recordset-base", |
|
9691 "recordset-sort", |
|
9692 "recordset-filter", |
|
9693 "recordset-indexer" |
|
9694 ] |
|
9695 }, |
|
9696 "recordset-base": { |
|
9697 "requires": [ |
|
9698 "base", |
|
9699 "arraylist" |
|
9700 ] |
|
9701 }, |
|
9702 "recordset-filter": { |
|
9703 "requires": [ |
|
9704 "recordset-base", |
|
9705 "array-extras", |
|
9706 "plugin" |
|
9707 ] |
|
9708 }, |
|
9709 "recordset-indexer": { |
|
9710 "requires": [ |
|
9711 "recordset-base", |
|
9712 "plugin" |
|
9713 ] |
|
9714 }, |
|
9715 "recordset-sort": { |
|
9716 "requires": [ |
|
9717 "arraysort", |
|
9718 "recordset-base", |
|
9719 "plugin" |
|
9720 ] |
|
9721 }, |
|
9722 "resize": { |
|
9723 "use": [ |
|
9724 "resize-base", |
|
9725 "resize-proxy", |
|
9726 "resize-constrain" |
|
9727 ] |
|
9728 }, |
|
9729 "resize-base": { |
|
9730 "requires": [ |
|
9731 "base", |
|
9732 "widget", |
|
9733 "event", |
|
9734 "oop", |
|
9735 "dd-drag", |
|
9736 "dd-delegate", |
|
9737 "dd-drop" |
|
9738 ], |
|
9739 "skinnable": true |
|
9740 }, |
|
9741 "resize-constrain": { |
|
9742 "requires": [ |
|
9743 "plugin", |
|
9744 "resize-base" |
|
9745 ] |
|
9746 }, |
|
9747 "resize-plugin": { |
|
9748 "optional": [ |
|
9749 "resize-constrain" |
|
9750 ], |
|
9751 "requires": [ |
|
9752 "resize-base", |
|
9753 "plugin" |
|
9754 ] |
|
9755 }, |
|
9756 "resize-proxy": { |
|
9757 "requires": [ |
|
9758 "plugin", |
|
9759 "resize-base" |
|
9760 ] |
|
9761 }, |
|
9762 "router": { |
|
9763 "optional": [ |
|
9764 "querystring-parse" |
|
9765 ], |
|
9766 "requires": [ |
|
9767 "array-extras", |
|
9768 "base-build", |
|
9769 "history" |
|
9770 ] |
|
9771 }, |
|
9772 "scrollview": { |
|
9773 "requires": [ |
|
9774 "scrollview-base", |
|
9775 "scrollview-scrollbars" |
|
9776 ] |
|
9777 }, |
|
9778 "scrollview-base": { |
|
9779 "requires": [ |
|
9780 "widget", |
|
9781 "event-gestures", |
|
9782 "event-mousewheel", |
|
9783 "transition" |
|
9784 ], |
|
9785 "skinnable": true |
|
9786 }, |
|
9787 "scrollview-base-ie": { |
|
9788 "condition": { |
|
9789 "name": "scrollview-base-ie", |
|
9790 "trigger": "scrollview-base", |
|
9791 "ua": "ie" |
|
9792 }, |
|
9793 "requires": [ |
|
9794 "scrollview-base" |
|
9795 ] |
|
9796 }, |
|
9797 "scrollview-list": { |
|
9798 "requires": [ |
|
9799 "plugin", |
|
9800 "classnamemanager" |
|
9801 ], |
|
9802 "skinnable": true |
|
9803 }, |
|
9804 "scrollview-paginator": { |
|
9805 "requires": [ |
|
9806 "plugin", |
|
9807 "classnamemanager" |
|
9808 ] |
|
9809 }, |
|
9810 "scrollview-scrollbars": { |
|
9811 "requires": [ |
|
9812 "classnamemanager", |
|
9813 "transition", |
|
9814 "plugin" |
|
9815 ], |
|
9816 "skinnable": true |
|
9817 }, |
|
9818 "selector": { |
|
9819 "requires": [ |
|
9820 "selector-native" |
|
9821 ] |
|
9822 }, |
|
9823 "selector-css2": { |
|
9824 "condition": { |
|
9825 "name": "selector-css2", |
|
9826 "test": function (Y) { |
|
9827 var DOCUMENT = Y.config.doc, |
|
9828 ret = DOCUMENT && !('querySelectorAll' in DOCUMENT); |
|
9829 |
|
9830 return ret; |
|
9831 }, |
|
9832 "trigger": "selector" |
|
9833 }, |
|
9834 "requires": [ |
|
9835 "selector-native" |
|
9836 ] |
|
9837 }, |
|
9838 "selector-css3": { |
|
9839 "requires": [ |
|
9840 "selector-native", |
|
9841 "selector-css2" |
|
9842 ] |
|
9843 }, |
|
9844 "selector-native": { |
|
9845 "requires": [ |
|
9846 "dom-base" |
|
9847 ] |
|
9848 }, |
|
9849 "series-area": { |
|
9850 "requires": [ |
|
9851 "series-cartesian", |
|
9852 "series-fill-util" |
|
9853 ] |
|
9854 }, |
|
9855 "series-area-stacked": { |
|
9856 "requires": [ |
|
9857 "series-stacked", |
|
9858 "series-area" |
|
9859 ] |
|
9860 }, |
|
9861 "series-areaspline": { |
|
9862 "requires": [ |
|
9863 "series-area", |
|
9864 "series-curve-util" |
|
9865 ] |
|
9866 }, |
|
9867 "series-areaspline-stacked": { |
|
9868 "requires": [ |
|
9869 "series-stacked", |
|
9870 "series-areaspline" |
|
9871 ] |
|
9872 }, |
|
9873 "series-bar": { |
|
9874 "requires": [ |
|
9875 "series-marker", |
|
9876 "series-histogram-base" |
|
9877 ] |
|
9878 }, |
|
9879 "series-bar-stacked": { |
|
9880 "requires": [ |
|
9881 "series-stacked", |
|
9882 "series-bar" |
|
9883 ] |
|
9884 }, |
|
9885 "series-base": { |
|
9886 "requires": [ |
|
9887 "graphics", |
|
9888 "axis-base" |
|
9889 ] |
|
9890 }, |
|
9891 "series-candlestick": { |
|
9892 "requires": [ |
|
9893 "series-range" |
|
9894 ] |
|
9895 }, |
|
9896 "series-cartesian": { |
|
9897 "requires": [ |
|
9898 "series-base" |
|
9899 ] |
|
9900 }, |
|
9901 "series-column": { |
|
9902 "requires": [ |
|
9903 "series-marker", |
|
9904 "series-histogram-base" |
|
9905 ] |
|
9906 }, |
|
9907 "series-column-stacked": { |
|
9908 "requires": [ |
|
9909 "series-stacked", |
|
9910 "series-column" |
|
9911 ] |
|
9912 }, |
|
9913 "series-combo": { |
|
9914 "requires": [ |
|
9915 "series-cartesian", |
|
9916 "series-line-util", |
|
9917 "series-plot-util", |
|
9918 "series-fill-util" |
|
9919 ] |
|
9920 }, |
|
9921 "series-combo-stacked": { |
|
9922 "requires": [ |
|
9923 "series-stacked", |
|
9924 "series-combo" |
|
9925 ] |
|
9926 }, |
|
9927 "series-combospline": { |
|
9928 "requires": [ |
|
9929 "series-combo", |
|
9930 "series-curve-util" |
|
9931 ] |
|
9932 }, |
|
9933 "series-combospline-stacked": { |
|
9934 "requires": [ |
|
9935 "series-combo-stacked", |
|
9936 "series-curve-util" |
|
9937 ] |
|
9938 }, |
|
9939 "series-curve-util": {}, |
|
9940 "series-fill-util": {}, |
|
9941 "series-histogram-base": { |
|
9942 "requires": [ |
|
9943 "series-cartesian", |
|
9944 "series-plot-util" |
|
9945 ] |
|
9946 }, |
|
9947 "series-line": { |
|
9948 "requires": [ |
|
9949 "series-cartesian", |
|
9950 "series-line-util" |
|
9951 ] |
|
9952 }, |
|
9953 "series-line-stacked": { |
|
9954 "requires": [ |
|
9955 "series-stacked", |
|
9956 "series-line" |
|
9957 ] |
|
9958 }, |
|
9959 "series-line-util": {}, |
|
9960 "series-marker": { |
|
9961 "requires": [ |
|
9962 "series-cartesian", |
|
9963 "series-plot-util" |
|
9964 ] |
|
9965 }, |
|
9966 "series-marker-stacked": { |
|
9967 "requires": [ |
|
9968 "series-stacked", |
|
9969 "series-marker" |
|
9970 ] |
|
9971 }, |
|
9972 "series-ohlc": { |
|
9973 "requires": [ |
|
9974 "series-range" |
|
9975 ] |
|
9976 }, |
|
9977 "series-pie": { |
|
9978 "requires": [ |
|
9979 "series-base", |
|
9980 "series-plot-util" |
|
9981 ] |
|
9982 }, |
|
9983 "series-plot-util": {}, |
|
9984 "series-range": { |
|
9985 "requires": [ |
|
9986 "series-cartesian" |
|
9987 ] |
|
9988 }, |
|
9989 "series-spline": { |
|
9990 "requires": [ |
|
9991 "series-line", |
|
9992 "series-curve-util" |
|
9993 ] |
|
9994 }, |
|
9995 "series-spline-stacked": { |
|
9996 "requires": [ |
|
9997 "series-stacked", |
|
9998 "series-spline" |
|
9999 ] |
|
10000 }, |
|
10001 "series-stacked": { |
|
10002 "requires": [ |
|
10003 "axis-stacked" |
|
10004 ] |
|
10005 }, |
|
10006 "shim-plugin": { |
|
10007 "requires": [ |
|
10008 "node-style", |
|
10009 "node-pluginhost" |
|
10010 ] |
|
10011 }, |
|
10012 "slider": { |
|
10013 "use": [ |
|
10014 "slider-base", |
|
10015 "slider-value-range", |
|
10016 "clickable-rail", |
|
10017 "range-slider" |
|
10018 ] |
|
10019 }, |
|
10020 "slider-base": { |
|
10021 "requires": [ |
|
10022 "widget", |
|
10023 "dd-constrain", |
|
10024 "event-key" |
|
10025 ], |
|
10026 "skinnable": true |
|
10027 }, |
|
10028 "slider-value-range": { |
|
10029 "requires": [ |
|
10030 "slider-base" |
|
10031 ] |
|
10032 }, |
|
10033 "sortable": { |
|
10034 "requires": [ |
|
10035 "dd-delegate", |
|
10036 "dd-drop-plugin", |
|
10037 "dd-proxy" |
|
10038 ] |
|
10039 }, |
|
10040 "sortable-scroll": { |
|
10041 "requires": [ |
|
10042 "dd-scroll", |
|
10043 "sortable" |
|
10044 ] |
|
10045 }, |
|
10046 "stylesheet": { |
|
10047 "requires": [ |
|
10048 "yui-base" |
|
10049 ] |
|
10050 }, |
|
10051 "substitute": { |
|
10052 "optional": [ |
|
10053 "dump" |
|
10054 ], |
|
10055 "requires": [ |
|
10056 "yui-base" |
|
10057 ] |
|
10058 }, |
|
10059 "swf": { |
|
10060 "requires": [ |
|
10061 "event-custom", |
|
10062 "node", |
|
10063 "swfdetect", |
|
10064 "escape" |
|
10065 ] |
|
10066 }, |
|
10067 "swfdetect": { |
|
10068 "requires": [ |
|
10069 "yui-base" |
|
10070 ] |
|
10071 }, |
|
10072 "tabview": { |
|
10073 "requires": [ |
|
10074 "widget", |
|
10075 "widget-parent", |
|
10076 "widget-child", |
|
10077 "tabview-base", |
|
10078 "node-pluginhost", |
|
10079 "node-focusmanager" |
|
10080 ], |
|
10081 "skinnable": true |
|
10082 }, |
|
10083 "tabview-base": { |
|
10084 "requires": [ |
|
10085 "node-event-delegate", |
|
10086 "classnamemanager" |
|
10087 ] |
|
10088 }, |
|
10089 "tabview-plugin": { |
|
10090 "requires": [ |
|
10091 "tabview-base" |
|
10092 ] |
|
10093 }, |
|
10094 "template": { |
|
10095 "use": [ |
|
10096 "template-base", |
|
10097 "template-micro" |
|
10098 ] |
|
10099 }, |
|
10100 "template-base": { |
|
10101 "requires": [ |
|
10102 "yui-base" |
|
10103 ] |
|
10104 }, |
|
10105 "template-micro": { |
|
10106 "requires": [ |
|
10107 "escape" |
|
10108 ] |
|
10109 }, |
|
10110 "test": { |
|
10111 "requires": [ |
|
10112 "event-simulate", |
|
10113 "event-custom", |
|
10114 "json-stringify" |
|
10115 ] |
|
10116 }, |
|
10117 "test-console": { |
|
10118 "requires": [ |
|
10119 "console-filters", |
|
10120 "test", |
|
10121 "array-extras" |
|
10122 ], |
|
10123 "skinnable": true |
|
10124 }, |
|
10125 "text": { |
|
10126 "use": [ |
|
10127 "text-accentfold", |
|
10128 "text-wordbreak" |
|
10129 ] |
|
10130 }, |
|
10131 "text-accentfold": { |
|
10132 "requires": [ |
|
10133 "array-extras", |
|
10134 "text-data-accentfold" |
|
10135 ] |
|
10136 }, |
|
10137 "text-data-accentfold": { |
|
10138 "requires": [ |
|
10139 "yui-base" |
|
10140 ] |
|
10141 }, |
|
10142 "text-data-wordbreak": { |
|
10143 "requires": [ |
|
10144 "yui-base" |
|
10145 ] |
|
10146 }, |
|
10147 "text-wordbreak": { |
|
10148 "requires": [ |
|
10149 "array-extras", |
|
10150 "text-data-wordbreak" |
|
10151 ] |
|
10152 }, |
|
10153 "timers": { |
|
10154 "requires": [ |
|
10155 "yui-base" |
|
10156 ] |
|
10157 }, |
|
10158 "transition": { |
|
10159 "requires": [ |
|
10160 "node-style" |
|
10161 ] |
|
10162 }, |
|
10163 "transition-timer": { |
|
10164 "condition": { |
|
10165 "name": "transition-timer", |
|
10166 "test": function (Y) { |
|
10167 var DOCUMENT = Y.config.doc, |
|
10168 node = (DOCUMENT) ? DOCUMENT.documentElement: null, |
|
10169 ret = true; |
|
10170 |
|
10171 if (node && node.style) { |
|
10172 ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); |
|
10173 } |
|
10174 |
|
10175 return ret; |
|
10176 }, |
|
10177 "trigger": "transition" |
|
10178 }, |
|
10179 "requires": [ |
|
10180 "transition" |
|
10181 ] |
|
10182 }, |
|
10183 "tree": { |
|
10184 "requires": [ |
|
10185 "base-build", |
|
10186 "tree-node" |
|
10187 ] |
|
10188 }, |
|
10189 "tree-labelable": { |
|
10190 "requires": [ |
|
10191 "tree" |
|
10192 ] |
|
10193 }, |
|
10194 "tree-lazy": { |
|
10195 "requires": [ |
|
10196 "base-pluginhost", |
|
10197 "plugin", |
|
10198 "tree" |
|
10199 ] |
|
10200 }, |
|
10201 "tree-node": {}, |
|
10202 "tree-openable": { |
|
10203 "requires": [ |
|
10204 "tree" |
|
10205 ] |
|
10206 }, |
|
10207 "tree-selectable": { |
|
10208 "requires": [ |
|
10209 "tree" |
|
10210 ] |
|
10211 }, |
|
10212 "tree-sortable": { |
|
10213 "requires": [ |
|
10214 "tree" |
|
10215 ] |
|
10216 }, |
|
10217 "uploader": { |
|
10218 "requires": [ |
|
10219 "uploader-html5", |
|
10220 "uploader-flash" |
|
10221 ] |
|
10222 }, |
|
10223 "uploader-flash": { |
|
10224 "requires": [ |
|
10225 "swf", |
|
10226 "widget", |
|
10227 "base", |
|
10228 "cssbutton", |
|
10229 "node", |
|
10230 "event-custom", |
|
10231 "file-flash", |
|
10232 "uploader-queue" |
|
10233 ] |
|
10234 }, |
|
10235 "uploader-html5": { |
|
10236 "requires": [ |
|
10237 "widget", |
|
10238 "node-event-simulate", |
|
10239 "file-html5", |
|
10240 "uploader-queue" |
|
10241 ] |
|
10242 }, |
|
10243 "uploader-queue": { |
|
10244 "requires": [ |
|
10245 "base" |
|
10246 ] |
|
10247 }, |
|
10248 "view": { |
|
10249 "requires": [ |
|
10250 "base-build", |
|
10251 "node-event-delegate" |
|
10252 ] |
|
10253 }, |
|
10254 "view-node-map": { |
|
10255 "requires": [ |
|
10256 "view" |
|
10257 ] |
|
10258 }, |
|
10259 "widget": { |
|
10260 "use": [ |
|
10261 "widget-base", |
|
10262 "widget-htmlparser", |
|
10263 "widget-skin", |
|
10264 "widget-uievents" |
|
10265 ] |
|
10266 }, |
|
10267 "widget-anim": { |
|
10268 "requires": [ |
|
10269 "anim-base", |
|
10270 "plugin", |
|
10271 "widget" |
|
10272 ] |
|
10273 }, |
|
10274 "widget-autohide": { |
|
10275 "requires": [ |
|
10276 "base-build", |
|
10277 "event-key", |
|
10278 "event-outside", |
|
10279 "widget" |
|
10280 ] |
|
10281 }, |
|
10282 "widget-base": { |
|
10283 "requires": [ |
|
10284 "attribute", |
|
10285 "base-base", |
|
10286 "base-pluginhost", |
|
10287 "classnamemanager", |
|
10288 "event-focus", |
|
10289 "node-base", |
|
10290 "node-style" |
|
10291 ], |
|
10292 "skinnable": true |
|
10293 }, |
|
10294 "widget-base-ie": { |
|
10295 "condition": { |
|
10296 "name": "widget-base-ie", |
|
10297 "trigger": "widget-base", |
|
10298 "ua": "ie" |
|
10299 }, |
|
10300 "requires": [ |
|
10301 "widget-base" |
|
10302 ] |
|
10303 }, |
|
10304 "widget-buttons": { |
|
10305 "requires": [ |
|
10306 "button-plugin", |
|
10307 "cssbutton", |
|
10308 "widget-stdmod" |
|
10309 ] |
|
10310 }, |
|
10311 "widget-child": { |
|
10312 "requires": [ |
|
10313 "base-build", |
|
10314 "widget" |
|
10315 ] |
|
10316 }, |
|
10317 "widget-htmlparser": { |
|
10318 "requires": [ |
|
10319 "widget-base" |
|
10320 ] |
|
10321 }, |
|
10322 "widget-locale": { |
|
10323 "requires": [ |
|
10324 "widget-base" |
|
10325 ] |
|
10326 }, |
|
10327 "widget-modality": { |
|
10328 "requires": [ |
|
10329 "base-build", |
|
10330 "event-outside", |
|
10331 "widget" |
|
10332 ], |
|
10333 "skinnable": true |
|
10334 }, |
|
10335 "widget-parent": { |
|
10336 "requires": [ |
|
10337 "arraylist", |
|
10338 "base-build", |
|
10339 "widget" |
|
10340 ] |
|
10341 }, |
|
10342 "widget-position": { |
|
10343 "requires": [ |
|
10344 "base-build", |
|
10345 "node-screen", |
|
10346 "widget" |
|
10347 ] |
|
10348 }, |
|
10349 "widget-position-align": { |
|
10350 "requires": [ |
|
10351 "widget-position" |
|
10352 ] |
|
10353 }, |
|
10354 "widget-position-constrain": { |
|
10355 "requires": [ |
|
10356 "widget-position" |
|
10357 ] |
|
10358 }, |
|
10359 "widget-skin": { |
|
10360 "requires": [ |
|
10361 "widget-base" |
|
10362 ] |
|
10363 }, |
|
10364 "widget-stack": { |
|
10365 "requires": [ |
|
10366 "base-build", |
|
10367 "widget" |
|
10368 ], |
|
10369 "skinnable": true |
|
10370 }, |
|
10371 "widget-stdmod": { |
|
10372 "requires": [ |
|
10373 "base-build", |
|
10374 "widget" |
|
10375 ] |
|
10376 }, |
|
10377 "widget-uievents": { |
|
10378 "requires": [ |
|
10379 "node-event-delegate", |
|
10380 "widget-base" |
|
10381 ] |
|
10382 }, |
|
10383 "yql": { |
|
10384 "requires": [ |
|
10385 "oop" |
|
10386 ] |
|
10387 }, |
|
10388 "yql-jsonp": { |
|
10389 "condition": { |
|
10390 "name": "yql-jsonp", |
|
10391 "test": function (Y) { |
|
10392 /* Only load the JSONP module when not in nodejs or winjs |
|
10393 TODO Make the winjs module a CORS module |
|
10394 */ |
|
10395 return (!Y.UA.nodejs && !Y.UA.winjs); |
|
10396 }, |
|
10397 "trigger": "yql", |
|
10398 "when": "after" |
|
10399 }, |
|
10400 "requires": [ |
|
10401 "jsonp", |
|
10402 "jsonp-url" |
|
10403 ] |
|
10404 }, |
|
10405 "yql-nodejs": { |
|
10406 "condition": { |
|
10407 "name": "yql-nodejs", |
|
10408 "trigger": "yql", |
|
10409 "ua": "nodejs", |
|
10410 "when": "after" |
|
10411 } |
|
10412 }, |
|
10413 "yql-winjs": { |
|
10414 "condition": { |
|
10415 "name": "yql-winjs", |
|
10416 "trigger": "yql", |
|
10417 "ua": "winjs", |
|
10418 "when": "after" |
|
10419 } |
|
10420 }, |
|
10421 "yui": {}, |
|
10422 "yui-base": {}, |
|
10423 "yui-later": { |
|
10424 "requires": [ |
|
10425 "yui-base" |
|
10426 ] |
|
10427 }, |
|
10428 "yui-log": { |
|
10429 "requires": [ |
|
10430 "yui-base" |
|
10431 ] |
|
10432 }, |
|
10433 "yui-throttle": { |
|
10434 "requires": [ |
|
10435 "yui-base" |
|
10436 ] |
|
10437 } |
|
10438 }); |
|
10439 YUI.Env[Y.version].md5 = 'd7ced98e3907d3c3c0655a93c6ac6867'; |
|
10440 |
|
10441 |
|
10442 }, '3.10.3', {"requires": ["loader-base"]}); |
|
10443 YUI.add('yui', function (Y, NAME) {}, '3.10.3', { |
|
10444 "use": [ |
|
10445 "get", |
|
10446 "features", |
|
10447 "intl-base", |
|
10448 "yui-log", |
|
10449 "yui-log-nodejs", |
|
10450 "yui-later", |
|
10451 "loader-base", |
|
10452 "loader-rollup", |
|
10453 "loader-yui3" |
|
10454 ] |
|
10455 }); |