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