canvio crlf

This commit is contained in:
Javi Gallego 2017-01-02 12:27:09 +01:00
parent 58b38a6971
commit 5d9eb50527
9 changed files with 385 additions and 395 deletions

View File

@ -15,7 +15,7 @@ export function factory() {
enabled: 'true',
className: DEFAULT_CLASS
}
}
};
}
_module.factory(NAME, factory);

View File

@ -7,14 +7,14 @@ export const NAME = util.getProviderName('interpolate');
function minErr() {}
function stringify(value) {
if (value == null) { // null || undefined
if (value === null) { // null || undefined
return '';
}
switch (typeof value) {
case 'string':
break;
case 'number':
value = '' + value;
value = String(value);
break;
default:
value = angular.toJson(value);
@ -25,14 +25,14 @@ function stringify(value) {
var $interpolateMinErr = ng.angular.$interpolateMinErr = ng.$$minErr('$interpolate');
$interpolateMinErr.throwNoconcat = function (text) {
$interpolateMinErr.throwNoconcat = function(text) {
throw $interpolateMinErr('noconcat',
'Error while interpolating: {0}\nStrict Contextual Escaping disallows ' +
'interpolations that concatenate multiple expressions when a trusted value is ' +
'required. See http://docs.angularjs.org/api/ng.$sce', text);
};
$interpolateMinErr.interr = function (text, err) {
$interpolateMinErr.interr = function(text, err) {
return $interpolateMinErr('interr', 'Can\'t interpolate: {0}\n{1}', text, err.toString());
};
@ -48,8 +48,8 @@ function $get($parse, $exceptionHandler, $sce) {
}
function unescapeText(text) {
return text.replace(escapedStartRegexp, self._startSymbol).
replace(escapedEndRegexp, self._endSymbol);
return text.replace(escapedStartRegexp, self._startSymbol)
.replace(escapedEndRegexp, self._endSymbol);
}
// TODO: this is the same as the constantWatchDelegate in parse.js
@ -61,11 +61,9 @@ function $get($parse, $exceptionHandler, $sce) {
return unwatch;
}
function $interpolate(text, mustHaveExpression, trustedContext, allOrNothing)
{
function $interpolate(text, mustHaveExpression, trustedContext, allOrNothing) {
// Provide a quick exit and simplified result function for text with no interpolation
if (!text.length || text.indexOf(self._startSymbol) === -1)
{
if (!text.length || text.indexOf(self._startSymbol) === -1) {
var constantInterp;
if (!mustHaveExpression) {
var unescapedText = unescapeText(text);
@ -77,7 +75,7 @@ function $get($parse, $exceptionHandler, $sce) {
return constantInterp;
}
allOrNothing = !!allOrNothing;
allOrNothing = Boolean(allOrNothing);
var startIndex,
endIndex,
index = 0,
@ -114,7 +112,7 @@ function $get($parse, $exceptionHandler, $sce) {
}
if (!mustHaveExpression || expressions.length) {
var compute = function (values) {
var compute = function(values) {
for (var i = 0, ii = expressions.length; i < ii; i++) {
if (allOrNothing && isUndefined(values[i])) return;
concat[expressionPositions[i]] = values[i];
@ -122,7 +120,7 @@ function $get($parse, $exceptionHandler, $sce) {
return concat.join('');
};
var getValue = function (value) {
var getValue = function(value) {
return trustedContext ?
$sce.getTrusted(trustedContext, value) :
$sce.valueOf(value);
@ -142,11 +140,10 @@ function $get($parse, $exceptionHandler, $sce) {
} catch (err) {
$exceptionHandler($interpolateMinErr.interr(text, err));
}
}, {
// all of these properties are undocumented for now
exp: text, //just for compatibility with regular watchers created via $watch
expressions: expressions,
exp: text, // just for compatibility with regular watchers created via $watch
expressions: expressions
});
}
@ -160,44 +157,43 @@ function $get($parse, $exceptionHandler, $sce) {
}
}
$interpolate.startSymbol = function () {
$interpolate.startSymbol = function() {
return startSymbol;
};
$interpolate.endSymbol = function () {
$interpolate.endSymbol = function() {
return endSymbol;
};
return $interpolate;
}
}
$get.$inject = ['$parse', '$exceptionHandler', '$sce'];
export class Interpolate
{
constructor () {
this._startSymbol='*[';
constructor() {
this._startSymbol = '*[';
this._endSymbol = ']*';
}
set startSymbol (value) {
set startSymbol(value) {
if (value) {
this._startSymbol = value;
return this;
} else {
return this._startSymbol;
}
};
}
set endSymbol (value) {
set endSymbol(value) {
if (value) {
this._endSymbol = value;
return this;
} else {
return this._endSymbol;
}
};
}
}

View File

@ -1,4 +1,4 @@
/*
.mdl-textfield {
width: 100%;
}
@ -19,4 +19,4 @@
.mdl-button--raised:hover {
background-color: #ffa410;
}
}*/

View File

@ -5,14 +5,14 @@ import Interpolate from './interpolate';
export const NAME = util.getProviderName('ResolveDefaultComponent');
function $get($injector, vnInterpolate){
function $get($injector, vnInterpolate) {
return {
getTemplate:function(name, attrs) {
getTemplate: function(name, attrs) {
this._frameworkName = 'Mdl';
let _name = util.getFactoryName( name + this._frameworkName);
let _name = util.getFactoryName(name + this._frameworkName);
let defaultfactory = $injector.has(_name) ? $injector.get(_name) : undefined;
if(!defaultfactory) {
if (!defaultfactory) {
throw new Error("factory is not defined");
}
@ -27,7 +27,7 @@ $get.$inject = ['$injector', 'vnInterpolate'];
export class ResolveDefaultComponent {
constructor() {
this._frameworkName='Mdl';
this._frameworkName = 'Mdl';
}
set frameworkName(value) {
this._frameworkName = value;
@ -36,4 +36,4 @@ export class ResolveDefaultComponent {
ResolveDefaultComponent.prototype.$get = $get;
var resolve = new ResolveDefaultComponent();
_module.provider(NAME,() => resolve);
_module.provider(NAME, () => resolve);

View File

@ -1,16 +1,16 @@
import {module as _module} from './module'
import * as util from './util'
import {module as _module} from './module';
import * as util from './util';
export const NAME = util.getProviderName ('RoutesLoader')
export const NAME = util.getProviderName('RoutesLoader');
function $get($http){
function $get($http) {
let script = document.currentScript || (() => {
let scripts = document.getElementsByTagName ('script');
let scripts = document.getElementsByTagName('script');
return scripts[scripts.length - 1];
}) ();
})();
let routesCdn = script.getAttribute ('routes-cdn');
let routesCdn = script.getAttribute('routes-cdn');
return $http({
method: 'GET',
@ -20,8 +20,8 @@ function $get($http){
$get.$inject = ["$http"];
export class RoutesLoader{ constructor () {} }
export class RoutesLoader { constructor() {} }
RoutesLoader.prototype.$get = $get;
var routes = new RoutesLoader ();
_module.provider (NAME, () => routes)
var routes = new RoutesLoader();
_module.provider(NAME, () => routes);

View File

@ -1,5 +1,4 @@
const _SplitingRegister = () => {
var _graph;
var dependencies = {};
@ -16,15 +15,14 @@ const _SplitingRegister = () => {
}
return {
registerGraph: function (graph) {
registerGraph: function(graph) {
_graph = graph;
},
register: function (dependency, loader) {
register: function(dependency, loader) {
dependencies[dependency] = loader;
},
execute: function (dependency) {
execute: function(dependency) {
return new Promise(resolve => {
var array = getDependencies(dependency);
var arrayClone = array.concat([]);
@ -34,26 +32,22 @@ const _SplitingRegister = () => {
}
(function loadDependency(dependency) {
if(!dependency){
if (!dependency) {
resolve(arrayClone);
return;
}
dependency().then(function (data) {
dependency().then(function(data) {
var _dependency = getDependency();
loadDependency(_dependency);
});
} (getDependency()))
})(getDependency());
});
},
write: function () {
write: function() {
console.log(_graph);
}
}
};
};
window.dependencies = _SplitingRegister();
export const SplitingRegister = window.dependencies;

View File

@ -6,15 +6,15 @@ import * as util from '../util';
const _NAME = 'textfield';
export const NAME = util.getName(_NAME);
directive.$inject =[resolveFactory.NAME, normalizerFactory.NAME];
export function directive (resolve, normalizer){
return{
require:'E',
template: function(_, attrs){
normalizer.normalize (attrs);
directive.$inject = [resolveFactory.NAME, normalizerFactory.NAME];
export function directive(resolve, normalizer) {
return {
require: 'E',
template: function(_, attrs) {
normalizer.normalize(attrs);
return resolve.getTemplate(_NAME, attrs);
}
}
};
}
_module.directive(NAME,directive);
_module.directive(NAME, directive);

View File

@ -19,7 +19,7 @@ export function factory() {
className: DEFAULT_CLASS,
type: DEFAULT_TYPE
}
}
};
}
_module.factory(NAME, factory);

View File

@ -5,43 +5,43 @@ const SERVICE = 'Service';
const DEFAULT = 'default';
export function getName(name) {
return constant.PREFIX + toUpperCamelCase(name)
return constant.PREFIX + toUpperCamelCase(name);
}
export function toUpperCamelCase(stringToConvert){
return stringToConvert.substr( 0, 1 ).toUpperCase() + stringToConvert.substr( 1 )
export function toUpperCamelCase(stringToConvert) {
return stringToConvert.substr(0, 1).toUpperCase() + stringToConvert.substr(1);
}
export function getFactoryName(name){
return getName(name) + FACTORY
export function getFactoryName(name) {
return getName(name) + FACTORY;
}
export function getServiceName(name){
return getName(name) + SERVICE
export function getServiceName(name) {
return getName(name) + SERVICE;
}
export function getModuleName(name){
export function getModuleName(name) {
return constant.PREFIX + name;
}
export function getProviderNameFromConfig(name){
export function getProviderNameFromConfig(name) {
return getName(name) + 'Provider';
}
export function getProviderName(name){
export function getProviderName(name) {
return getName(name);
}
export function getTemplateName(componentName,frameworkName){
return componentName + '.' + frameworkName + '.' + '.html'
export function getTemplateName(componentName, frameworkName) {
return componentName + '.' + frameworkName + '.html';
}
export function getVendorDependencies(vendors){
export function getVendorDependencies(vendors) {
let dependencies = [];
Object.keys(vendors).forEach((vendor)=>{
Object.keys(vendors).forEach(vendor => {
let name = vendors[vendor].name;
if(name){
dependencies.push(name)
if (name) {
dependencies.push(name);
}
});
return dependencies;