-
Notifications
You must be signed in to change notification settings - Fork 27
/
angular-classy.min.js.map
executable file
·1 lines (1 loc) · 25.8 KB
/
angular-classy.min.js.map
1
{"version":3,"file":"angular-classy.min.js","sources":["angular-classy.js"],"names":["classyVersion","availablePlugins","alreadyRegisteredModules","getActiveClassyPlugins","name","origModule","getNextRequires","module","angular","i","requires","length","pluginName","plugin","obj","replace","__classyDefaults","copy","options","pluginDo","methodName","params","callbacks","plugins","classy","activePlugins","__options","prototype","pluginKeys","Object","keys","classyOptions","isFunction","before","returnVal","apply","after","copyAndExtendDeep","dst","key","value","_i","_len","arguments","constructor","origModuleMethod","reqs","configFn","activeClassyPlugins","version","controller","classObj","classyController","classFns","init","this","preInit","controllers","controllerArray","cC","cCs","localInject","classConstructor","buildConstructor","buildOptions","classKeys","hasOwnProperty","option","optionName","shorthandOptions","optionNames","j","isObject","k","extend","klass","$inject","injectIndex","deps","__classDepNames","isArray","depName","pluginPromises","then","push","initClass","postInit","boundClass","bind","all","enabled","addToScope","addToClass","privatePrefix","keyName","hasPrivatePrefix","string","prefix","slice","dataProp","data","call","isString","getter","$parse","fnKey","fnValue","$scope","scopeShortcut","depNames","inject","pluginDepNames","concat","initBefore","preDeps","ignore","__indexOf","indexOf","item","l","methods","boundMethod","method","bindWatchToClass","_watchKeywords","normal","objectEquality","collection","isActive","watch","Error","watchFns","expression","fn","$watch","$watchCollection","convertToFunctionExpression","context","parse","watchKeywords","watchRegistered","watchType","watchFn","keywords","keyword","normalizedExpression","exp"],"mappings":"CAAC,WAMD,GAAIA,GAAgB,QAGhBC,KAEAC,KAEAC,EAAyB,SAASC,EAAMC,GAG1C,GAAIC,GAAkB,SAASF,GAC7B,GAAIF,EAAyBE,GAI3B,IAAK,GAHDG,GAASC,QAAQD,OAAOH,GAGnBK,EAAI,EAAGA,EAAIF,EAAOG,SAASC,OAAQF,IAAK,CAC/C,GAAIG,GAAaL,EAAOG,SAASD,GAC7BI,EAASZ,EAAiBW,EAC1BC,KACFC,EAAIF,G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,EAAM3F,KAAKrC,QAAQyG,iBACrBpE,KAAKiF,4BAA4BS,EAAsBtE,GACvDsE,CAEFH,GAAQnE,EAAOuE,EAAKb,EAAIvD,GACxB8D,GAAkB,CAClB,SAIN,IAAKA,EAAiB,CAEpB,GAAIM,GAAM3F,KAAKrC,QAAQyG,iBACrBpE,KAAKiF,4BAA4BJ,EAAYzD,GAC7CyD,CACF7E,MAAK4E,SAASN,OAAOlD,EAAOuE,EAAKb,EAAIvD,UAO/CtE,QAAQD,OAAO,UAAW,kBAAkB,0BAA0B,qBAAqB,cAAc,kBAAkB","sourcesContent":[";(function() {\n/*\nAngular Classy 1.2.3\nDave Jeffery, @DaveJ\nLicense: MIT\n */\nvar classyVersion = '1.2.3';\n\n/* global angular */\nvar availablePlugins = {};\n\nvar alreadyRegisteredModules = {};\n\nvar getActiveClassyPlugins = function(name, origModule) {\n // TODO: Write a test to ensure that this method gets called the correct amount of times\n\n var getNextRequires = function(name) {\n if (alreadyRegisteredModules[name]) {\n var module = angular.module(name);\n\n // for pluginName in module.requires\n for (var i = 0; i < module.requires.length; i++) {\n var pluginName = module.requires[i];\n var plugin = availablePlugins[pluginName];\n if (plugin) {\n obj[pluginName] = plugin;\n if (!plugin.name) {\n plugin.name = pluginName.replace('classy.', '');\n }\n if (!origModule.__classyDefaults) {\n origModule.__classyDefaults = {};\n }\n origModule.__classyDefaults[plugin.name] = angular.copy(plugin.options || {});\n }\n getNextRequires(pluginName);\n }\n }\n };\n\n var obj = {};\n alreadyRegisteredModules[name] = true;\n getNextRequires(name);\n return obj;\n};\n\n\n/**\n* Runs a particular stage of the lifecycle for all plugins.\n* Also runs the `before` and `after` callbacks if specified.\n*/\nvar pluginDo = function(methodName, params, callbacks) {\n // params = [klass, deps, module];\n\n var plugins = params[2].classy.activePlugins;\n var options = params[0].__options || params[0].prototype.__options;\n\n // for plugin of plugins\n var pluginKeys = Object.keys(plugins);\n for (var i = 0; i < pluginKeys.length; i++) {\n var plugin = plugins[pluginKeys[i]];\n plugin.options = options[plugin.name] || {};\n plugin.classyOptions = options;\n\n if (callbacks && angular.isFunction(callbacks.before)) {\n callbacks.before(plugin);\n }\n\n var returnVal;\n if (plugin && methodName && angular.isFunction(plugin[methodName])) {\n returnVal = plugin[methodName].apply(plugin, params);\n }\n\n if (callbacks && angular.isFunction(callbacks.after)) {\n callbacks.after(plugin, returnVal);\n }\n }\n};\n\n\n/**\n* Utility method to take an object and extend it with other objects\n* It does this recursively (deep) on inner objects too.\n*/\nvar copyAndExtendDeep = function(dst) {\n var key, obj, value, _i, _len;\n for (_i = 0, _len = arguments.length; _i < _len; _i++) {\n obj = arguments[_i];\n if (obj !== dst) {\n for (key in obj) {\n value = obj[key];\n if (dst[key] && dst[key].constructor && dst[key].constructor === Object) {\n copyAndExtendDeep(dst[key], value);\n } else {\n dst[key] = angular.copy(value);\n }\n }\n }\n }\n return dst;\n};\n\nvar origModuleMethod = angular.module;\n\nangular.module = function(name, reqs, configFn) {\n /*\n * We have to monkey-patch the `angular.module` method to see if 'classy' has been specified\n * as a requirement. We also need the module name to we can register our classy controllers.\n * Unfortunately there doesn't seem to be a more pretty/pluggable way to this.\n */\n\n var module = origModuleMethod(name, reqs, configFn);\n\n if (reqs) {\n if (name === 'classy.core') {\n availablePlugins[name] = {};\n }\n\n var activeClassyPlugins = getActiveClassyPlugins(name, module);\n if (activeClassyPlugins['classy.core']) {\n module.classy = {\n version: classyVersion,\n plugin: {\n controller: function(plugin) { availablePlugins[name] = plugin; }\n },\n options: {\n controller: {}\n },\n activePlugins: activeClassyPlugins,\n controller: function(classObj) {\n /*\n * `classyController` contains only a set of proxy functions for `classFns`,\n * this is because I suspect that performance is better this way.\n * TODO: Test performance to see if this is the most performant way to do it.\n */\n\n // Pre-initialisation (before instance is created)\n classFns.preInit(classyController, classObj, module);\n\n function classyController() {\n // Initialisation (after instance is created)\n classFns.init(this, arguments, module);\n }\n\n return classyController;\n },\n /**\n * Accepts an array of controllers and returns the module, e.g.:\n * `module.classy.controllers([xxx, xxx]).config(xxx).run(xxx)`\n * Requested in issue #29\n */\n controllers: function(controllerArray) {\n // for classObj in controllerArray\n for (var i = 0; i < controllerArray.length; i++) {\n this.controller(controllerArray[i]);\n }\n\n return module;\n }\n };\n module.cC = module.classy.controller;\n module.cCs = module.classy.controllers;\n }\n }\n return module;\n};\n\n\nvar classFns = {\n\n localInject: ['$q'],\n\n preInit: function(classConstructor, classObj, module) {\n this.buildConstructor(classConstructor, classObj);\n this.buildOptions(classConstructor, classObj, module);\n\n pluginDo('preInitBefore', [classConstructor, classObj, module]);\n pluginDo('preInit', [classConstructor, classObj, module]);\n pluginDo('preInitAfter', [classConstructor, classObj, module]);\n },\n\n /**\n * Add properties from class object onto the class constructor\n */\n buildConstructor: function(classConstructor, classObj) {\n // for key of classObj\n var classKeys = Object.keys(classObj);\n for (var i = 0; i < classKeys.length; i++) {\n var key = classKeys[i];\n if (!classObj.hasOwnProperty(key)) continue;\n classConstructor.prototype[key] = classObj[key];\n }\n },\n\n /**\n * Build options object for all classy plugins\n */\n buildOptions: function(classConstructor, classObj, module) {\n var options = copyAndExtendDeep({}, module.__classyDefaults, module.classy.options.controller, classObj.__options);\n var shorthandOptions = {};\n\n // Collect shorthand options\n var option, optionName;\n var optionNames = Object.keys(options);\n for (var j = 0; j < optionNames.length; j++) {\n optionName = optionNames[j];\n option = options[optionNames[j]];\n if (!angular.isObject(option)) {\n shorthandOptions[optionName] = option;\n }\n }\n\n // Apply shorthand options to plugin options\n if (Object.keys(shorthandOptions).length) {\n for (var k = 0; k < optionNames.length; k++) {\n optionName = optionNames[k];\n option = options[optionNames[k]];\n if (angular.isObject(option)) {\n angular.extend(option, shorthandOptions);\n }\n }\n }\n\n classConstructor.prototype.__options = options;\n },\n\n init: function(klass, $inject, module) {\n var injectIndex = 0;\n var deps = {};\n\n // for key in klass.constructor.__classDepNames\n for (var i = 0; i < klass.constructor.__classDepNames.length; i++) {\n var key = klass.constructor.__classDepNames[i];\n deps[key] = $inject[injectIndex];\n injectIndex++;\n }\n pluginDo(null, [klass, deps, module], {\n before: function(plugin) {\n if (angular.isArray(plugin.localInject)) {\n // for depName in plugin.localInject\n for (var j = 0; j < plugin.localInject.length; j++) {\n var depName = plugin.localInject[j];\n plugin[depName] = $inject[injectIndex];\n injectIndex++;\n }\n }\n }\n });\n\n pluginDo('initBefore', [klass, deps, module]);\n\n var pluginPromises = [];\n pluginDo('init', [klass, deps, module], {\n after: function(plugin, returnVal) {\n if (returnVal && returnVal.then) {\n // Naively assume this is a promise\n pluginPromises.push(returnVal);\n }\n }\n });\n\n var initClass = function() {\n if (angular.isFunction(klass.init)) {\n klass.init();\n }\n pluginDo('initAfter', [klass, deps, module]);\n this.postInit(klass, deps, module);\n };\n var boundClass = angular.bind(this, initClass);\n if (pluginPromises.length) {\n // Injected dependency below is $q\n $inject[injectIndex].all(pluginPromises).then(boundClass);\n } else {\n boundClass();\n }\n },\n postInit: function(klass, deps, module) {\n pluginDo('postInitBefore', [klass, deps, module]);\n pluginDo('postInit', [klass, deps, module]);\n pluginDo('postInitAfter', [klass, deps, module]);\n }\n};\n\nangular.module('classy.core', []);\n\nangular.module('classy.bindData', ['classy.core']).classy.plugin.controller({\n localInject: ['$parse'],\n options: {\n enabled: true,\n addToScope: true,\n addToClass: true,\n privatePrefix: '_',\n keyName: 'data'\n },\n hasPrivatePrefix: function(string) {\n var prefix = this.options.privatePrefix;\n if (!prefix) {\n return false;\n } else {\n return string.slice(0, prefix.length) === prefix;\n }\n },\n init: function(klass, deps, module) {\n // Adds objects returned by or set to the `$scope`\n var dataProp = klass.constructor.prototype[this.options.keyName];\n if (this.options.enabled && dataProp) {\n var data = angular.copy(dataProp);\n if (angular.isFunction(data)) {\n data = data.call(klass);\n } else if (angular.isObject(data)) {\n for (var key in data) {\n var value = data[key];\n if (angular.isString(value)) {\n var getter = this.$parse(value);\n data[key] = getter(klass);\n } else {\n data[key] = value;\n }\n }\n }\n for (var fnKey in data) {\n var fnValue = data[fnKey];\n if (this.options.addToClass) {\n klass[fnKey] = fnValue;\n }\n if (this.options.addToScope && !this.hasPrivatePrefix(fnKey) && deps.$scope) {\n deps.$scope[fnKey] = fnValue;\n }\n }\n }\n }\n});\n\nangular.module('classy.bindDependencies', ['classy.core']).classy.plugin.controller({\n options: {\n enabled: true,\n scopeShortcut: '$'\n },\n preInit: function(classConstructor, classObj, module) {\n var depNames = classObj.inject || [];\n if (angular.isArray(depNames)) {\n this.inject(classConstructor, depNames, module);\n }\n },\n inject: function(classConstructor, depNames, module) {\n var pluginDepNames = [];\n for (var pluginName in module.classy.activePlugins) {\n var plugin = module.classy.activePlugins[pluginName];\n if (angular.isArray(plugin.localInject)) {\n pluginDepNames = pluginDepNames.concat(plugin.localInject);\n }\n }\n pluginDepNames = pluginDepNames.concat(classFns.localInject);\n classConstructor.__classDepNames = angular.copy(depNames);\n classConstructor.$inject = depNames.concat(pluginDepNames);\n },\n initBefore: function(klass, deps, module) {\n if (this.options.enabled) {\n var preDeps = klass.constructor.$inject;\n for (var i = 0; i < preDeps.length; ++i) {\n var key = preDeps[i];\n klass[key] = deps[key];\n if (key === '$scope' && this.options.scopeShortcut) {\n klass[this.options.scopeShortcut] = klass[key];\n }\n }\n }\n }\n});\n\nangular.module('classy.bindMethods', ['classy.core']).classy.plugin.controller({\n localInject: ['$parse'],\n options: {\n enabled: true,\n addToScope: true,\n addToClass: true,\n privatePrefix: '_',\n ignore: ['constructor', 'init'],\n keyName: 'methods'\n },\n hasPrivatePrefix: function(string) {\n var prefix;\n prefix = this.options.privatePrefix;\n if (!prefix) {\n return false;\n } else {\n return string.slice(0, prefix.length) === prefix;\n }\n },\n init: function(klass, deps, module) {\n // indexOf shim for IE <= 8\n var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };\n\n if (this.options.enabled) {\n var methods = klass.constructor.prototype[this.options.keyName];\n for (var key in methods) {\n var method = methods[key];\n\n var boundMethod;\n if (angular.isFunction(method) && !(__indexOf.call(this.options.ignore, key) >= 0)) {\n boundMethod = angular.bind(klass, method);\n } else if (angular.isString(method)) {\n var getter = this.$parse(method);\n boundMethod = function() {\n return getter(klass);\n };\n }\n if (angular.isFunction(boundMethod)) {\n if (this.options.addToClass) {\n klass[key] = boundMethod;\n }\n if (this.options.addToScope && !this.hasPrivatePrefix(key) && deps.$scope) {\n deps.$scope[key] = boundMethod;\n }\n }\n }\n }\n }\n});\n\nangular.module('classy.register', ['classy.core']).classy.plugin.controller({\n options: {\n enabled: true,\n key: 'name'\n },\n preInit: function(classConstructor, classObj, module) {\n if (this.options.enabled && angular.isString(classObj[this.options.key])) {\n module.controller(classObj[this.options.key], classConstructor);\n }\n }\n});\n\nangular.module('classy.watch', ['classy.core']).classy.plugin.controller({\n localInject: ['$parse'],\n options: {\n enabled: true,\n bindWatchToClass: false,\n _watchKeywords: {\n normal: [],\n objectEquality: ['{object}', '{deep}'],\n collection: ['{collection}', '{shallow}']\n }\n },\n isActive: function(klass, deps) {\n if (this.options.enabled && angular.isObject(klass.watch)) {\n if (!deps.$scope) {\n throw new Error(\"You need to inject `$scope` to use the watch object\");\n return false;\n }\n return true;\n }\n },\n watchFns: {\n normal: function(klass, expression, fn, deps) {\n return deps.$scope.$watch(expression, angular.bind(klass, fn));\n },\n objectEquality: function(klass, expression, fn, deps) {\n return deps.$scope.$watch(expression, angular.bind(klass, fn), true);\n },\n collection: function(klass, expression, fn, deps) {\n return deps.$scope.$watchCollection(expression, angular.bind(klass, fn));\n }\n },\n convertToFunctionExpression: function(expression, context) {\n var parse = this.$parse;\n return function() {\n return parse(expression)(context);\n };\n },\n postInit: function(klass, deps, module) {\n if (!this.isActive(klass, deps)) {\n return;\n }\n var watchKeywords = this.options._watchKeywords;\n\n // for expression, fn of klass.watch\n for (var expression in klass.watch) {\n var fn = klass.watch[expression];\n if (angular.isString(fn)) {\n fn = klass[fn];\n }\n if (angular.isString(expression) && angular.isFunction(fn)) {\n var watchRegistered = false;\n\n // Search for keywords that identify it is a non-standard watch\n // for watchType, watchFn of @watchFns\n for (var watchType in this.watchFns) {\n var watchFn = this.watchFns[watchType];\n if (watchRegistered) {\n break;\n }\n // for keyword in watchKeywords[watchType]\n var keywords = watchKeywords[watchType];\n for (var i = 0; i < keywords.length; i++) {\n var keyword = keywords[i];\n\n if (expression.indexOf(keyword) !== -1) {\n var normalizedExpression = expression.replace(keyword, '');\n\n var exp = this.options.bindWatchToClass ?\n this.convertToFunctionExpression(normalizedExpression, klass) :\n normalizedExpression;\n\n watchFn(klass, exp, fn, deps);\n watchRegistered = true;\n break;\n }\n }\n }\n if (!watchRegistered) {\n // If no keywords have been found then register it as a normal watch\n var exp = this.options.bindWatchToClass ?\n this.convertToFunctionExpression(expression, klass) :\n expression;\n this.watchFns.normal(klass, exp, fn, deps);\n }\n }\n }\n }\n});\n\nangular.module('classy', [\"classy.bindData\",\"classy.bindDependencies\",\"classy.bindMethods\",\"classy.core\",\"classy.register\",\"classy.watch\"]);\n})();"],"sourceRoot":"/source/"}