loader-debug.js revision d1ec270f90bbeb39839582feab0a6c823a13e655
(function() {
META = {
skin: {
defaultSkin: 'sam',
path: 'skin.css',
//rollup: 3
},
modules: {
"anim": {
"submodules": {
"anim-base": {
"requires": [
"base-base",
"node-style"
]
},
"anim-color": {
"requires": [
"anim-base"
]
},
"anim-curve": {
"requires": [
"anim-xy"
]
},
"anim-easing": {
"requires": [
"anim-base"
]
},
"anim-node-plugin": {
"requires": [
"node-pluginhost",
"anim-base"
]
},
"anim-scroll": {
"requires": [
"anim-base"
]
},
"anim-xy": {
"requires": [
"anim-base",
"node-screen"
]
}
}
},
"async-queue": {
"requires": [
"event-custom"
]
},
"attribute": {
"submodules": {
"attribute-base": {
"requires": [
"event-custom"
]
},
"attribute-complex": {
"requires": [
"attribute-base"
]
}
}
},
"base": {
"submodules": {
"base-base": {
"requires": [
"attribute-base"
]
},
"base-build": {
"requires": [
"base-base"
]
},
"base-pluginhost": {
"requires": [
"base-base",
"pluginhost"
]
}
}
},
"cache": {
"requires": [
"plugin"
]
},
"classnamemanager": {
"requires": [
"yui-base"
]
},
"collection": {
"submodules": {
"array-extras": {},
"array-invoke": {},
"arraylist": {},
"arraylist-add": {
"requires": [
"arraylist"
]
},
"arraylist-filter": {
"requires": [
"arraylist"
]
}
}
},
"compat": {
"requires": [
"event-base",
"dom",
"dump",
"substitute"
]
},
"console": {
"plugins": {
"console-filters": {
"requires": [
"plugin",
"console",
"skin-sam-console-filters"
],
"skinnable": true
}
},
"requires": [
"yui-log",
"widget",
"substitute",
"skin-sam-console"
],
"skinnable": true
},
"cookie": {
"requires": [
"yui-base"
]
},
"cssbase": {
"after": [
"cssreset",
"cssfonts",
"cssgrids",
"cssreset-context",
"cssfonts-context",
"cssgrids-context"
],
"type": "css"
},
"cssbase-context": {
"after": [
"cssreset",
"cssfonts",
"cssgrids",
"cssreset-context",
"cssfonts-context",
"cssgrids-context"
],
"path": "cssbase/base-context-min.css",
"type": "css"
},
"cssfonts": {
"type": "css"
},
"cssfonts-context": {
"path": "cssfonts/fonts-context-min.css",
"type": "css"
},
"cssgrids": {
"optional": [
"cssreset"
],
"requires": [
"cssfonts"
],
"type": "css"
},
"cssgrids-context": {
"optional": [
"cssreset-context"
],
"path": "cssgrids/grids-context-min.css",
"requires": [
"cssfonts-context"
],
"type": "css"
},
"cssreset": {
"type": "css"
},
"cssreset-context": {
"path": "cssreset/reset-context-min.css",
"type": "css"
},
"dataschema": {
"submodules": {
"dataschema-array": {
"requires": [
"dataschema-base"
]
},
"dataschema-base": {
"requires": [
"base"
]
},
"dataschema-json": {
"requires": [
"dataschema-base",
"json"
]
},
"dataschema-text": {
"requires": [
"dataschema-base"
]
},
"dataschema-xml": {
"requires": [
"dataschema-base"
]
}
}
},
"datasource": {
"submodules": {
"datasource-arrayschema": {
"requires": [
"datasource-local",
"plugin",
"dataschema-array"
]
},
"datasource-cache": {
"requires": [
"datasource-local",
"cache"
]
},
"datasource-function": {
"requires": [
"datasource-local"
]
},
"datasource-get": {
"requires": [
"datasource-local",
"get"
]
},
"datasource-io": {
"requires": [
"datasource-local",
"io-base"
]
},
"datasource-jsonschema": {
"requires": [
"datasource-local",
"plugin",
"dataschema-json"
]
},
"datasource-local": {
"requires": [
"base"
]
},
"datasource-polling": {
"requires": [
"datasource-local"
]
},
"datasource-textschema": {
"requires": [
"datasource-local",
"plugin",
"dataschema-text"
]
},
"datasource-xmlschema": {
"requires": [
"datasource-local",
"plugin",
"dataschema-xml"
]
}
}
},
"datatype": {
"submodules": {
"datatype-date": {
"lang": [
"en",
"en-US",
"fr-FR",
"ko-KR"
],
"requires": [
"yui-base"
]
},
"datatype-number": {
"requires": [
"yui-base"
]
},
"datatype-xml": {
"requires": [
"yui-base"
]
}
}
},
"dd": {
"submodules": {
"dd-constrain": {
"requires": [
"dd-drag"
]
},
"dd-ddm": {
"requires": [
"dd-ddm-base",
"event-resize"
]
},
"dd-ddm-base": {
"requires": [
"node",
"base",
"yui-throttle"
]
},
"dd-ddm-drop": {
"requires": [
"dd-ddm"
]
},
"dd-delegate": {
"optional": [
"dd-drop-plugin"
],
"requires": [
"dd-drag",
"event-mouseenter"
]
},
"dd-drag": {
"requires": [
"dd-ddm-base"
]
},
"dd-drop": {
"requires": [
"dd-ddm-drop"
]
},
"dd-drop-plugin": {
"requires": [
"dd-drop"
]
},
"dd-plugin": {
"optional": [
"dd-constrain",
"dd-proxy"
],
"requires": [
"dd-drag"
]
},
"dd-proxy": {
"requires": [
"dd-drag"
]
},
"dd-scroll": {
"requires": [
"dd-drag"
]
}
}
},
"dd-value": {
"requires": [
"dd-constrain"
]
},
"dom": {
"plugins": {
"selector-css3": {
"requires": [
"selector-css2"
]
}
},
"requires": [
"oop"
],
"submodules": {
"dom-base": {
"requires": [
"oop"
]
},
"dom-screen": {
"requires": [
"dom-base",
"dom-style"
]
},
"dom-style": {
"requires": [
"dom-base"
]
},
"selector": {
"requires": [
"dom-base"
]
},
"selector-css2": {
"requires": [
"selector-native"
]
},
"selector-native": {
"requires": [
"dom-base"
]
}
}
},
"dump": {
"requires": [
"yui-base"
]
},
"event": {
"expound": "node-base",
"submodules": {
"event-base": {
"expound": "node-base",
"requires": [
"event-custom-base"
]
},
"event-delegate": {
"requires": [
"node-base"
]
},
"event-focus": {
"requires": [
"node-base"
]
},
"event-key": {
"requires": [
"node-base"
]
},
"event-mouseenter": {
"requires": [
"node-base"
]
},
"event-mousewheel": {
"requires": [
"node-base"
]
},
"event-resize": {
"requires": [
"node-base"
]
}
}
},
"event-custom": {
"submodules": {
"event-custom-base": {
"requires": [
"oop",
"yui-later"
]
},
"event-custom-complex": {
"requires": [
"event-custom-base"
]
}
}
},
"event-simulate": {
"requires": [
"event-base"
]
},
"history": {
"requires": [
"node"
]
},
"imageloader": {
"requires": [
"base-base",
"node-style",
"node-screen"
]
},
"intl": {
"requires": [
"intl-base",
"event-custom"
]
},
"io": {
"submodules": {
"io-base": {
"requires": [
"event-custom-base",
"querystring-stringify-simple"
]
},
"io-form": {
"requires": [
"io-base",
"node-base",
"node-style"
]
},
"io-queue": {
"requires": [
"io-base",
"queue-promote"
]
},
"io-upload-iframe": {
"requires": [
"io-base",
"node-base"
]
},
"io-xdr": {
"requires": [
"io-base",
"datatype-xml"
]
}
}
},
"json": {
"submodules": {
"json-parse": {
"requires": [
"yui-base"
]
},
"json-stringify": {
"requires": [
"yui-base"
]
}
}
},
"loader": {
"requires": [
"get"
]
},
"node": {
"plugins": {
"align-plugin": {
"requires": [
"node-screen",
"node-pluginhost"
]
},
"node-event-simulate": {
"requires": [
"node-base",
"event-simulate"
]
},
"shim-plugin": {
"requires": [
"node-style",
"node-pluginhost"
]
}
},
"requires": [
"dom",
"event-base"
],
"submodules": {
"node-base": {
"requires": [
"dom-base",
"selector-css2",
"event-base"
]
},
"node-event-delegate": {
"requires": [
"node-base",
"event-delegate"
]
},
"node-pluginhost": {
"requires": [
"node-base",
"pluginhost"
]
},
"node-screen": {
"requires": [
"dom-screen",
"node-base"
]
},
"node-style": {
"requires": [
"dom-style",
"node-base"
]
}
}
},
"node-focusmanager": {
"requires": [
"attribute",
"node",
"plugin",
"node-event-simulate",
"event-key",
"event-focus"
]
},
"node-menunav": {
"requires": [
"node",
"classnamemanager",
"plugin",
"node-focusmanager",
"skin-sam-node-menunav"
],
"skinnable": true
},
"oop": {
"requires": [
"yui-base"
]
},
"overlay": {
"requires": [
"widget",
"widget-stdmod",
"widget-position",
"widget-position-align",
"widget-stack",
"widget-position-constrain",
"skin-sam-overlay"
],
"skinnable": true
},
"plugin": {
"requires": [
"base-base"
]
},
"pluginhost": {
"requires": [
"yui-base"
]
},
"profiler": {
"requires": [
"yui-base"
]
},
"querystring": {
"submodules": {
"querystring-parse": {
"requires": [
"yui-base",
"array-extras"
]
},
"querystring-stringify": {
"requires": [
"yui-base"
]
}
}
},
"querystring-parse-simple": {
"path": "querystring/querystring-parse-simple.js",
"requires": [
"yui-base"
]
},
"querystring-stringify-simple": {
"path": "querystring/querystring-stringify-simple.js",
"requires": [
"yui-base"
]
},
"queue-promote": {
"requires": [
"yui-base"
]
},
"queue-run": {
"path": "async-queue/async-queue-min.js",
"requires": [
"event-custom"
]
},
"slider": {
"requires": [
"widget",
"dd-value",
"skin-sam-slider"
],
"skinnable": true
},
"sortable": {
"requires": [
"dd-delegate",
"dd-drop-plugin",
"dd-proxy"
]
},
"stylesheet": {
"requires": [
"yui-base"
]
},
"substitute": {
"optional": [
"dump"
]
},
"test": {
"requires": [
"substitute",
"node",
"json",
"event-simulate"
],
"skinnable": true
},
"widget": {
"plugins": {
"widget-child": {},
"widget-parent": {
"requires": [
"arraylist"
]
},
"widget-position": {},
"widget-position-align": {
"requires": [
"widget-position"
]
},
"widget-position-constrain": {
"requires": [
"widget-position"
]
},
"widget-stack": {
"requires": [
"skin-sam-widget-stack"
],
"skinnable": true
},
"widget-stdmod": {}
},
"requires": [
"skin-sam-widget"
],
"skinnable": true,
"submodules": {
"widget-base": {
"requires": [
"attribute",
"event-focus",
"base",
"node",
"classnamemanager"
]
},
"widget-htmlparser": {
"requires": [
"widget-base"
]
}
}
},
"widget-anim": {
"requires": [
"plugin",
"anim-base"
]
},
"widget-locale": {
"requires": [
"widget-base"
]
},
"yui": {
"submodules": {
"get": {},
"intl-base": {},
"yui-base": {},
"yui-later": {},
"yui-log": {},
"yui-throttle": {}
}
}
},
// Patterns are module definitions which will be added with
// the default options if a definition is not found. The
// assumption is that the module itself will be in the default
// location, and if there are any additional dependencies, they
// will have to be fetched with a second request. This could
// happen multiple times, each segment resulting in a new
// dependency list.
//
// types: regex, prefix, function
patterns: {
'gallery-': {
filter: {
'searchExp': VERSION,
'replaceStr': GALLERY_VERSION
}
},
// expand 'lang|module|lang'
'lang|': {
// Y.log('testing data: ' + data);
if (lang) {
if (!mod) {
// Y.log('action creating ' + packName);
}
}
}
}
}
}
};
})();
(function() {
/**
* Loader dynamically loads script and css files. It includes the dependency
* info for the version of the library in use, and will automatically pull in
* dependencies for the modules requested. It supports rollup files and will
* automatically use these when appropriate in order to minimize the number of
* http connections required to load all of the dependencies. It can load the
* files from the Yahoo! CDN, and it can utilize the combo service provided on
* this network to reduce the number of http connections required to download
* YUI files.
*
* @module loader
*/
/**
* Loader dynamically loads script and css files. It includes the dependency
* info for the version of the library in use, and will automatically pull in
* dependencies for the modules requested. It supports rollup files and will
* automatically use these when appropriate in order to minimize the number of
* http connections required to load all of the dependencies. It can load the
* files from the Yahoo! CDN, and it can utilize the combo service provided on
* this network to reduce the number of http connections required to download
* YUI files.
*
* While the loader can be instantiated by the end user, it normally is not.
* @see YUI.use for the normal use case. The use function automatically will
* pull in missing dependencies.
*
* @class Loader
* @constructor
* @param o an optional set of configuration options. Valid options:
* <ul>
* <li>base:
* The base dir</li>
* <li>secureBase:
* The secure base dir (not implemented)</li>
* <li>comboBase:
* The YUI combo service base dir. Ex: http://yui.yahooapis.com/combo?</li>
* <li>root:
* The root path to prepend to module names for the combo service. Ex: 2.5.2/build/</li>
* <li>filter:
*
* A filter to apply to result urls. This filter will modify the default
* path for all modules. The default path for the YUI library is the
* minified version of the files (e.g., event-min.js). The filter property
* can be a predefined filter or a custom filter. The valid predefined
* filters are:
* <dl>
* <dt>DEBUG</dt>
* <dd>Selects the debug versions of the library (e.g., event-debug.js).
* This option will automatically include the Logger widget</dd>
* <dt>RAW</dt>
* <dd>Selects the non-minified version of the library (e.g., event.js).</dd>
* </dl>
* You can also define a custom filter, which must be an object literal
* containing a search expression and a replace string:
* <pre>
* myFilter: {
* 'searchExp': "-min\\.js",
* 'replaceStr': "-debug.js"
* }
* </pre>
*
* </li>
* <li>filters: per-component filter specification. If specified for a given component, this overrides the filter config</li>
* <li>combine:
* Use the YUI combo service to reduce the number of http connections required to load your dependencies</li>
* <li>ignore:
* A list of modules that should never be dynamically loaded</li>
* <li>force:
* A list of modules that should always be loaded when required, even if already present on the page</li>
* <li>insertBefore:
* Node or id for a node that should be used as the insertion point for new nodes</li>
* <li>charset:
* charset for dynamic nodes (deprecated, use jsAttributes or cssAttributes)</li>
* <li>jsAttributes: object literal containing attributes to add to script nodes</li>
* <li>cssAttributes: object literal containing attributes to add to link nodes</li>
* <li>timeout:
* number of milliseconds before a timeout occurs when dynamically loading nodes. in not set, there is no timeout</li>
* <li>context:
* execution context for all callbacks</li>
* <li>onSuccess:
* callback for the 'success' event</li>
* <li>onFailure: callback for the 'failure' event</li>
* <li>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.</li>
* <li>onTimeout:
* callback for the 'timeout' event</li>
* <li>onProgress:
* callback executed each time a script or css file is loaded</li>
* <li>modules:
* A list of module definitions. See Loader.addModule for the supported module metadata</li>
* </ul>
*/
var NOT_FOUND = {},
NO_REQUIREMENTS = [],
CSS = 'css',
JS = 'js',
}),
L = Y.Lang;
Y.Loader = function(o) {
/**
* Internal callback to handle multiple internal insert() calls
* so that css is inserted prior to js
* @property _internalCallback
* @private
*/
// this._internalCallback = null;
/**
* Callback that will be executed when the loader is finished
* with an insert
* @method onSuccess
* @type function
*/
// this.onSuccess = null;
/**
* Callback that will be executed if there is a failure
* @method onFailure
* @type function
*/
// this.onFailure = null;
/**
* 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.
* @method onCSS
* @type function
*/
// this.onCSS = null;
/**
* Callback executed each time a script or css file is loaded
* @method onProgress
* @type function
*/
// this.onProgress = null;
/**
* Callback that will be executed if a timeout occurs
* @method onTimeout
* @type function
*/
// this.onTimeout = null;
/**
* The execution context for all callbacks
* @property context
* @default {YUI} the YUI instance
*/
this.context = Y;
/**
* Data that is passed to all callbacks
* @property data
*/
// this.data = null;
/**
* Node reference or id where new nodes should be inserted before
* @property insertBefore
* @type string|HTMLElement
*/
// this.insertBefore = null;
/**
* The charset attribute for inserted nodes
* @property charset
* @type string
* @deprecated, use cssAttributes or jsAttributes
*/
// this.charset = null;
/**
* An object literal containing attributes to add to link nodes
* @property cssAttributes
* @type object
*/
// this.cssAttributes = null;
/**
* An object literal containing attributes to add to script nodes
* @property jsAttributes
* @type object
*/
// this.jsAttributes = null;
/**
* The base directory.
* @property base
* @type string
* @default http://yui.yahooapis.com/[YUI VERSION]/build/
*/
/**
* Base path for the combo service
* @property comboBase
* @type string
* @default http://yui.yahooapis.com/combo?
*/
/*
* Base path for language packs.
*/
// this.langBase = Y.Env.meta.langBase;
/**
* If configured, YUI JS resources will use the combo
* handler
* @property combine
* @type boolean
* @default true if a base dir isn't in the config
*/
/**
* Max url length for combo urls. The default is 2048 for
* internet explorer, and 8192 otherwise. This is the URL
* limit for the Yahoo! hosted combo servers. If consuming
* a different combo service that has a different URL limit
* it is possible to override this default by supplying
* the maxURLLength config option. The config option will
* only take effect if lower than the default.
*
* Browsers:
* IE: 2048
* Other A-Grade Browsers: Higher that what is typically supported
* 'Capable' mobile browsers: @TODO
*
* Servers:
* Apache: 8192
*
* @property maxURLLength
* @type int
*/
this.maxURLLength = MAX_URL_LENGTH;
/**
* Ignore modules registered on the YUI global
* @property ignoreRegistered
* @default false
*/
// this.ignoreRegistered = false;
/**
* Root path to prepend to module path for the combo
* service
* @property root
* @type string
* @default [YUI VERSION]/build/
*/
/**
* Timeout value in milliseconds. If set, this value will be used by
* the get utility. the timeout event will fire if
* a timeout occurs.
* @property timeout
* @type int
*/
this.timeout = 0;
/**
* A list of modules that should not be loaded, even if
* they turn up in the dependency tree
* @property ignore
* @type string[]
*/
// this.ignore = null;
/**
* A list of modules that should always be loaded, even
* if they have already been inserted into the page.
* @property force
* @type string[]
*/
// this.force = null;
this.forceMap = {};
/**
* Should we allow rollups
* @property allowRollup
* @type boolean
* @default true
*/
this.allowRollup = true;
/**
* A filter to apply to result urls. This filter will modify the default
* path for all modules. The default path for the YUI library is the
* minified version of the files (e.g., event-min.js). The filter property
* can be a predefined filter or a custom filter. The valid predefined
* filters are:
* <dl>
* <dt>DEBUG</dt>
* <dd>Selects the debug versions of the library (e.g., event-debug.js).
* This option will automatically include the Logger widget</dd>
* <dt>RAW</dt>
* <dd>Selects the non-minified version of the library (e.g., event.js).</dd>
* </dl>
* You can also define a custom filter, which must be an object literal
* containing a search expression and a replace string:
* <pre>
* myFilter: {
* 'searchExp': "-min\\.js",
* 'replaceStr': "-debug.js"
* }
* </pre>
* @property filter
* @type string|{searchExp: string, replaceStr: string}
*/
// this.filter = null;
/**
* per-component filter specification. If specified for a given component, this
* overrides the filter config.
* @property filters
* @type object
*/
this.filters = {};
/**
* The list of requested modules
* @property required
* @type {string: boolean}
*/
this.required = {};
/**
* If a module name is predefined when requested, it is checked againsts
* the patterns provided in this property. If there is a match, the
* module is added with the default configuration.
*
* At the moment only supporting module prefixes, but anticipate supporting
* at least regular expressions.
* @property patterns
* @type Object
*/
/**
* The library metadata
* @property moduleInfo
*/
// this.moduleInfo = Y.merge(Y.Env.meta.moduleInfo);
this.moduleInfo = {};
/**
* Provides the information used to skin the skinnable components.
* The following skin definition would result in 'skin1' and 'skin2'
* being loaded for calendar (if calendar was requested), and
* 'sam' for all other skinnable components:
*
* <code>
* skin: {
*
* // The default skin, which is automatically applied if not
* // overriden by a component-specific skin definition.
* // Change this in to apply a different skin globally
* defaultSkin: 'sam',
*
* // This is combined with the loader base property to get
* // the default root directory for a skin. ex:
*
* // The name of the rollup css file for the skin
* path: 'skin.css',
*
* // The number of skinnable components requested that are
* // required before using the rollup file rather than the
* // individual component css files
* rollup: 3,
*
* // Any component-specific overrides can be specified here,
* // making it possible to load different skins for different
* // components. It is possible to load more than one skin
* // for a given component as well.
* overrides: {
* calendar: ['skin1', 'skin2']
* }
* }
* </code>
* @property skin
*/
this._internal = true;
for (i in defaults) {
if (defaults.hasOwnProperty(i)) {
}
}
for (i in onPage) {
}
}
this._internal = false;
/**
* List of rollup files found in the library metadata
* @property rollups
*/
// this.rollups = null;
/**
* Whether or not to load optional dependencies for
* the requested modules
* @property loadOptional
* @type boolean
* @default false
*/
// this.loadOptional = false;
/**
* All of the derived dependencies in sorted order, which
* will be populated when either calculate() or insert()
* is called
* @property sorted
* @type string[]
*/
this.sorted = [];
/**
* Set when beginning to compute the dependency tree.
* Composed of what YUI reports to be loaded combined
* with what has been loaded by any instance on the page
* with the version number specified in the metadata.
* @propery loaded
* @type {string: boolean}
*/
/**
* A list of modules to attach to the YUI instance when complete.
* If not supplied, the sorted list of dependencies are applied.
* @property attaching
*/
// this.attaching = null;
/**
* Flag to indicate the dependency tree needs to be recomputed
* if insert is called again.
* @property dirty
* @type boolean
* @default true
*/
this.dirty = true;
/**
* List of modules inserted by the utility
* @property inserted
* @type {string: boolean}
*/
this.inserted = {};
/**
* List of skipped modules during insert() because the module
* was not defined
* @property skipped
*/
this.skipped = {};
// Y.on('yui:load', this.loadNext, this);
this._config(o);
};
FILTER_DEFS: {
RAW: {
'searchExp': "-min\\.js",
'replaceStr': ".js"
},
DEBUG: {
'searchExp': "-min\\.js",
'replaceStr': "-debug.js"
}
},
SKIN_PREFIX: "skin-",
_config: function(o) {
var i, j, val, f;
// apply config values
if (o) {
for (i in o) {
if (o.hasOwnProperty(i)) {
val = o[i];
if (i == 'require') {
} else if (i == 'modules') {
// add a hash of module definitions
for (j in val) {
if (val.hasOwnProperty(j)) {
}
}
} else if (i == 'maxURLLength') {
} else {
this[i] = val;
}
}
}
}
// fix filter
f = this.filter;
if (L.isString(f)) {
f = f.toUpperCase();
this.filterName = f;
this.filter = this.FILTER_DEFS[f];
if (f == 'DEBUG') {
}
}
},
/**
* Returns the skin module name for the specified skin name. If a
* module name is supplied, the returned skin module name is
* specific to the module passed in.
* @method formatSkin
* @param skin {string} the name of the skin
* @param mod {string} optional: the name of a module to skin
* @return {string} the full skin module name
*/
var s = this.SKIN_PREFIX + skin;
if (mod) {
s = s + "-" + mod;
}
return s;
},
/*
* Reverses <code>formatSkin</code>, providing the skin name and
* module name if the string matches the pattern for skins.
* @method parseSkin
* @param mod {string} the module name to parse
* @return {skin: string, module: string} the parsed skin name
* and module name, or null if the supplied string does not match
* the skin pattern
*
* This isn't being used at the moment
*
*/
// parseSkin: function(mod) {
//
// if (mod.indexOf(this.SKIN_PREFIX) === 0) {
// var a = mod.split("-");
// return {skin: a[1], module: a[2]};
// }
// return null;
// },
/**
* Adds the skin def to the module info
* @method _addSkin
* @param skin {string} the name of the skin
* @param mod {string} the name of the module
* @param parent {string} parent module if this is a skin of a
* submodule or plugin
* @return {string} the module name for the skin
* @private
*/
info = this.moduleInfo,
/*
// Add a module definition for the skin rollup css
// Y.log('ext? ' + mod + ": " + ext);
if (!info[name]) {
// Y.log('adding skin ' + name);
this.addModule({
'name': name,
'type': 'css',
'path': sinf.base + skin + '/' + sinf.path,
//'supersedes': '*',
'after': sinf.after,
'rollup': sinf.rollup,
'ext': ext
});
}
*/
// Add a module definition for the module-specific skin css
if (mod) {
// Y.log('adding skin ' + name);
this.addModule({
'name': name,
'type': 'css',
'ext': ext
});
}
}
return name;
},
/** Add a new module to the component metadata.
* <dl>
* <dt>name:</dt> <dd>required, the component name</dd>
* <dt>type:</dt> <dd>required, the component type (js or css)</dd>
* <dt>path:</dt> <dd>required, the path to the script from "base"</dd>
* <dt>requires:</dt> <dd>array of modules required by this component</dd>
* <dt>optional:</dt> <dd>array of optional modules for this component</dd>
* <dt>supersedes:</dt> <dd>array of the modules this component replaces</dd>
* <dt>after:</dt> <dd>array of modules the components which, if present, should be sorted above this one</dd>
* <dt>rollup:</dt> <dd>the number of superseded modules required for automatic rollup</dd>
* <dt>fullpath:</dt> <dd>If fullpath is specified, this is used instead of the configured base + path</dd>
* <dt>skinnable:</dt> <dd>flag to determine if skin assets should automatically be pulled in</dd>
* <dt>submodules:</dt> <dd>a has of submodules</dd>
* </dl>
* @method addModule
* @param o An object containing the module data
* @param name the module name (optional), required if not in the module data
* @param persist {boolean} persist the availability of this module across instances
*
* @return {boolean} true if the module was added, false if
* the object passed in did not provide all required attributes
*/
if (!o || !o.name) {
return false;
}
if (!o.type) {
}
// o.path = name + "/" + name + "-min." + o.type;
}
// Y.log('New module ' + name);
this.moduleInfo[name] = o;
// Handle submodule logic
if (subs) {
sup = [];
l = 0;
for (i in subs) {
if (subs.hasOwnProperty(i)) {
s = subs[i];
this.addModule(s, i);
if (o.skinnable) {
}
// looks like we are expected to work out the metadata
// for the parent module language packs from what is
// specified in the child modules.
if (!smod) {
}
}
}
// Y.log('pack ' + packName + ' should supersede ' + supName);
// Add rollup file, need to add to supersedes list too
}
}
l++;
}
}
o.supersedes = sup;
}
if (plugins) {
for (i in plugins) {
if (plugins.hasOwnProperty(i)) {
// plug.requires.push(name);
if (o.skinnable) {
}
}
}
}
// if (silent) {
// Y.log("addModule (sets dirty to true): " + name);
this.dirty = true;
// }
if (persist) {
}
return o;
},
/**
* Add a requirement for one or more module
* @method require
* @param what {string[] | string*} the modules to load
*/
this.dirty = true;
},
/**
* Returns an object containing properties for all modules required
* in order to load the requested module
* @method getRequires
* @param mod The module definition from moduleInfo
*/
getRequires: function(mod) {
return NO_REQUIREMENTS;
}
// Y.log('already expanded');
}
// Y.log("getRequires: " + mod.name + " (dirty:" + this.dirty + ", expanded:" + mod.expanded + ")");
// Y.log(mod.name + ' requiring ' + r[i]);
d.push(r[i]);
m = this.getModule(r[i]);
add = this.getRequires(m);
}
}
// get the requirements from superseded modules, if any
r=mod.supersedes;
if (r) {
// Y.log(mod.name + ' requiring ' + r[i]);
d.push(r[i]);
m = this.getModule(r[i]);
add = this.getRequires(m);
}
}
}
if (o && this.loadOptional) {
d.push(o[i]);
}
}
}
},
/**
* Returns a hash of module names the supplied module satisfies.
* @method getProvides
* @param name {string} The name of the module
* @return what this module provides
*/
getProvides: function(name) {
if (!m) {
return NOT_FOUND;
}
if (m && !m.provides) {
o = {};
s = m.supersedes;
if (s) {
Y.Array.each(s, function(v) {
Y.mix(o, this.getProvides(v));
}, this);
}
o[name] = true;
m.provides = o;
}
return m.provides;
},
/**
* Calculates the dependency tree, the result is stored in the sorted
* property
* @method calculate
* @param o optional options object
* @param type optional argument to prune modules
*/
this._config(o);
this._setup();
this._explode();
if (this.allowRollup) {
this._rollup();
}
this._reduce();
this._sort();
// Y.log("after calculate: " + this.sorted);
// this.dirty = false;
}
},
// var packName = this.getLangPackName(lang, m.name);
this.addModule({
after: ['intl'],
requires: ['intl'],
supersedes: []
}, packName, true);
// Y.log('add pack path: ' + packPath);
return this.moduleInfo[packName];
},
/**
* Investigates the current YUI configuration on the page. By default,
* modules already detected will not be loaded again unless a force
* option is encountered. Called by calculate()
* @method _setup
* @private
*/
_setup: function() {
// Create skin modules
if (m && m.skinnable) {
// Y.log("skinning: " + name);
if (o && o[name]) {
}
} else {
}
}
// create the module definition
}
}
}
}
// available modules
if (!this.ignoreRegistered) {
}
// Y.log("Already loaded stuff: " + L.dump(l, 0));
// add the ignore list to the list of loaded packages
if (this.ignore) {
// OU.appendArray(l, this.ignore);
}
// expand the list to include superseded modules
for (j in l) {
// Y.log("expanding: " + j);
if (l.hasOwnProperty(j)) {
Y.mix(l, this.getProvides(j));
}
}
// remove modules on the force list from the loaded list
if (this.force) {
if (this.force[i] in l) {
delete l[this.force[i]];
}
}
}
// Y.log("loaded expanded: " + L.dump(l, 0));
// this.loaded = l;
},
/**
* Builds a module name for a language pack
* @function getLangPackName
* @param lang {string} the language code
* @param mname {string} the module to build it for
* @return {string} the language pack module name
*/
}),
/**
* Inspects the required modules list looking for additional
* dependencies. Expands the required list to include all
* required modules. Called by calculate()
* @method _explode
* @private
*/
_explode: function() {
// the setup phase is over, all modules have been created
this.dirty = false;
// Y.log('exploding ' + i);
if (m) {
// Y.log('checking intl: ' + m.name + ', ' + m.lang + ', ' + this.lang);
// Y.log('lang pack: ' + lang);
// Y.log('pack name: ' + packName);
if (lang) {
// this._addLangPack(lang, m, packName); // add on demand?
r.intl = true;
r[packName] = true;
delete r[m.name];
r[m.name] = true;
// Y.log('added: ' + packName);
}
}
if (expound) {
}
reqs = this.getRequires(m);
// Y.log('via explode: ' + reqs);
}
}, this);
},
//TODO: Remove name check - it's a quick hack to fix pattern WIP
if (!name) {
return null;
}
// check the patterns library to see if we should automatically add
// the module with defaults
if (!m) {
// Y.log('testing patterns ' + Y.Object.keys(patterns));
for (i in patterns) {
if (patterns.hasOwnProperty(i)) {
// Y.log('testing pattern ' + i);
p = patterns[i];
// switch (type) {
// case 'regex':
// break;
// case 'function':
// break;
// default: // prefix
// if (name.indexOf(i) > -1) {
// add = true;
// }
// }
// use the metadata supplied for the pattern
// as the module definition.
found = p;
break;
}
}
}
if (found) {
if (p.action) {
// Y.log('executing pattern action: ' + i);
} else {
// ext true or false?
}
}
}
return m;
},
/**
* Look for rollup packages to determine if all of the modules a
* rollup supersedes are required. If so, include the rollup to
* help reduce the total number of connections required. Called
* by calculate()
* @method _rollup
* @private
*/
_rollup: function() {
// find and cache rollup modules
for (i in info) {
if (info.hasOwnProperty(i)) {
m = this.getModule(i);
// if (m && m.rollup && m.supersedes) {
if (m && m.rollup) {
rollups[i] = m;
}
}
}
}
// make as many passes as needed to pick up rollup rollups
for (;;) {
rolled = false;
// go through the rollup candidates
for (i in rollups) {
if (rollups.hasOwnProperty(i)) {
// there can be only one, unless forced
m = this.getModule(i);
s = m.supersedes || [];
roll = false;
// @TODO remove continue
if (!m.rollup) {
continue;
}
c = 0;
// check the threshold
// if the superseded module is loaded, we can't load the rollup
// unless it has been forced
roll = false;
break;
// increment the counter if this module is required. if we are
// beyond the rollup threshold, we will use the rollup module
} else if (r[s[j]]) {
c++;
// Y.log("adding to thresh: " + c + ", " + s[j]);
if (roll) {
// Y.log("over thresh " + c + ", " + s[j]);
break;
}
}
}
if (roll) {
// Y.log("adding rollup: " + i);
// add the rollup
r[i] = true;
rolled = true;
// expand the rollup's dependencies
this.getRequires(m);
}
}
}
}
// if we made it here w/o rolling up something, we are done
if (!rolled) {
break;
}
}
},
/**
* Remove superceded modules and loaded modules. Called by
* calculate() after we have the mega list of all dependencies
* @method _reduce
* @private
*/
_reduce: function() {
for (i in r) {
if (r.hasOwnProperty(i)) {
m = this.getModule(i);
// remove if already loaded
if ((this.loaded[i] && (!this.forceMap[i]) && !this.ignoreRegistered) || (type && m && m.type != type)) {
delete r[i];
// remove anything this module supersedes
} else {
s = m && m.supersedes;
if (s) {
if (s[j] in r) {
delete r[s[j]];
}
}
}
}
}
}
// Y.log('required now: ' + Y.Object.keys(r));
},
_attach: function() {
// this is the full list of items the YUI needs attached,
// which is needed if some dependencies are already on
// the page without their dependencies.
if (this.attaching) {
} else {
}
// this._pushEvents();
},
_finish: function() {
this._continue();
},
_onSuccess: function() {
this._attach();
for (i in skipped) {
if (skipped.hasOwnProperty(i)) {
delete this.inserted[i];
}
}
this.skipped = {};
f = this.onSuccess;
if (f) {
msg: 'success',
success: true,
});
}
this._finish();
},
_onFailure: function(o) {
this._attach();
var f = this.onFailure;
if (f) {
success: false
});
}
this._finish();
},
_onTimeout: function() {
this._attach();
var f = this.onTimeout;
if (f) {
msg: 'timeout',
success: false
});
}
this._finish();
},
/**
* Sorts the dependency tree. The last step of calculate()
* @method _sort
* @private
*/
_sort: function() {
// create an indexed list
info = this.moduleInfo,
done = {},
// returns true if b is not loaded, and is required
// directly or by means of modules it supersedes.
return false;
}
r = m.expanded;
// check if this module requires the other directly
return true;
}
// check if this module should be sorted after the other
return true;
}
// check if this module requires one the other supersedes
if (s) {
return true;
}
}
}
// external css files should be sorted below yui css
return true;
}
return false;
});
// keep going until we make a pass without moving anything
for (;;) {
l = s.length;
moved = false;
// start the loop after items that are already sorted
for (j=p; j<l; j=j+1) {
// check the next module on the list to see if its
// dependencies have been met
a = s[j];
// check everything below current item and move if we
// find a requirement for the current item
for (k=j+1; k<l; k=k+1) {
doneKey = a + s[k];
// extract the dependency so we can move it up
b = s.splice(k, 1);
// insert the dependency above the item that
// requires it
// only swap two dependencies once to short circut
// circular dependencies
// keep working
moved = true;
break;
}
}
// jump out of loop if we moved something
if (moved) {
break;
// this item is sorted, move our pointer and keep going
} else {
p = p + 1;
}
}
// when we make it here and moved is false, we are
// finished sorting
if (!moved) {
break;
}
}
this.sorted = s;
},
// Y.log('private _insert() ' + (type || '') + ', ' + Y.id, "info", "loader");
// restore the state at the time of the request
if (source) {
}
// build the dependency list
this.calculate(o); // don't include type so we can process CSS and script in
// one pass when the type is not specified.
if (!type) {
var self = this;
// Y.log("trying to load css first");
this._internalCallback = function() {
if (f) {
}
self._internalCallback = null;
};
// _queue.running = false;
return;
}
// set a flag to indicate the load has started
this._loading = true;
// flag to indicate we are done with the combo service
// and any additional files will need to be loaded
// individually
this._combineComplete = {};
// start the load
this.loadNext();
},
_continue: function() {
}
},
/**
* inserts the requested modules and their dependencies.
* <code>type</code> can be "js" or "css". Both script and
* css are inserted if type is not provided.
* @method insert
* @param o optional options object
* @param type {string} the type of dependency to insert
*/
});
this._continue();
},
/**
* Executed every time a module is loaded, and if we are in a load
* cycle, we attempt to load the next script. Public so that it
* is possible to call this if using a method other than
* Y.register to determine when scripts are fully loaded
* @method loadNext
* @param mname {string} optional the name of the module that has
* been loaded (which is usually why it is time to load the next
* one)
*/
// It is possible that this function is executed due to something
// else one the page loading a YUI module. Only react when we
// are actively loading something
if (!this._loading) {
return;
}
callback=function(o) {
}
},
onsuccess=function(o) {
// Y.log('loading next, just loaded' + o.data);
};
combining = [];
this._combining = combining;
s = this.sorted;
urls = [];
for (i=0; i<len; i++) {
m = this.getModule(s[i]);
// Do not try to combine non-yui JS
}
if (i < (len - 1)) {
url += '&';
}
}
}
// if (m.type === CSS) {
attr = this.cssAttributes;
} else {
attr = this.jsAttributes;
}
// @TODO get rid of the redundant Get code
onFailure: this._onFailure,
onTimeout: this._onTimeout,
insertBefore: this.insertBefore,
autopurge: false,
context: this
});
return;
} else {
this._combineComplete[type] = true;
}
}
if (mname) {
// if the module that was just loaded isn't what we were expecting,
// continue to wait
return;
}
// The global handler that is called when each module is loaded
// will pass that module name to this function. Storing this
// data to avoid loading the same module multiple times
if (this.onProgress) {
});
}
}
s=this.sorted;
// this.inserted keeps track of what the loader has loaded.
// move on if this item is done.
if (s[i] in this.inserted) {
// Y.log(s[i] + " alread loaded ");
continue;
}
// Because rollups will cause multiple load notifications
// from Y, loadNext may be called multiple times for
// the same module when loading a rollup. We can safely
// skip the subsequent requests
if (s[i] === this._loading) {
return;
}
// log("inserting " + s[i]);
m = this.getModule(s[i]);
if (!m) {
this.inserted[s[i]] = true;
this.skipped[s[i]] = true;
continue;
}
// The load type is stored to offer the possibility to load
// the css separately from the script.
this._loading = s[i];
attr = this.cssAttributes;
} else {
attr = this.jsAttributes;
}
data: s[i],
insertBefore: this.insertBefore,
onFailure: this._onFailure,
onTimeout: this._onTimeout,
autopurge: false,
});
return;
}
}
// we are finished
this._loading = null;
fn = this._internalCallback;
// internal callback for loading css first
if (fn) {
// Y.log('loader internal');
this._internalCallback = null;
// } else if (this.onSuccess) {
} else {
// Y.log('loader complete');
// call Y.use passing this instance. Y will use the sorted
// dependency list.
this._onSuccess();
}
},
/**
* method _filter
* @param u {string} the string to filter
* @param name {string} the name of the module, if we are processing
* a single module as opposed to a combined url
* @return {string} the filtered string
* @private
*/
var f = this.filter,
if (u) {
if (hasFilter) {
}
if (f) {
}
}
return u;
},
/**
* Generates the full url for a module
* method _url
* @param path {string} the path fragment
* @return {string} the full url
* @private
*/
}
};
})();
}, '@VERSION@' );