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

@ -1,21 +1,21 @@
import {module as _module} from '../module';
import * as util from '../util';
import * as constant from '../constants';
import template from './check.mdl.html';
const _NAME = 'check';
const DEFAULT_CLASS = 'mdl-checkbox__input';
export const NAME = util.getFactoryName(_NAME + constant.MATERIAL_DESIGN_FRAMEWORK);
export function factory() {
return {
template: template,
default: {
enabled: 'true',
className: DEFAULT_CLASS
}
}
}
_module.factory(NAME, factory);
import {module as _module} from '../module';
import * as util from '../util';
import * as constant from '../constants';
import template from './check.mdl.html';
const _NAME = 'check';
const DEFAULT_CLASS = 'mdl-checkbox__input';
export const NAME = util.getFactoryName(_NAME + constant.MATERIAL_DESIGN_FRAMEWORK);
export function factory() {
return {
template: template,
default: {
enabled: 'true',
className: DEFAULT_CLASS
}
};
}
_module.factory(NAME, factory);

View File

@ -1,206 +1,202 @@
import {module} from './module';
import {ng} from 'vendor';
import * as util from './util';
export const NAME = util.getProviderName('interpolate');
function minErr() {}
function stringify(value) {
if (value == null) { // null || undefined
return '';
}
switch (typeof value) {
case 'string':
break;
case 'number':
value = '' + value;
break;
default:
value = angular.toJson(value);
}
return value;
}
var $interpolateMinErr = ng.angular.$interpolateMinErr = ng.$$minErr('$interpolate');
$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) {
return $interpolateMinErr('interr', 'Can\'t interpolate: {0}\n{1}', text, err.toString());
};
function $get($parse, $exceptionHandler, $sce) {
var startSymbolLength = this._startSymbol.length,
endSymbolLength = this._endSymbol.length,
escapedStartRegexp = new RegExp(this._startSymbol.replace(/./g, escape), 'g'),
escapedEndRegexp = new RegExp(this._endSymbol.replace(/./g, escape), 'g'),
self = this;
function escape(ch) {
return '\\\\\\' + ch;
}
function unescapeText(text) {
return text.replace(escapedStartRegexp, self._startSymbol).
replace(escapedEndRegexp, self._endSymbol);
}
// TODO: this is the same as the constantWatchDelegate in parse.js
function constantWatchDelegate(scope, listener, objectEquality, constantInterp) {
var unwatch = scope.$watch(function constantInterpolateWatch(scope) {
unwatch();
return constantInterp(scope);
}, listener, objectEquality);
return unwatch;
}
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)
{
var constantInterp;
if (!mustHaveExpression) {
var unescapedText = unescapeText(text);
constantInterp = valueFn(unescapedText);
constantInterp.exp = text;
constantInterp.expressions = [];
constantInterp.$$watchDelegate = constantWatchDelegate;
}
return constantInterp;
}
allOrNothing = !!allOrNothing;
var startIndex,
endIndex,
index = 0,
expressions = [],
parseFns = [],
textLength = text.length,
exp,
concat = [],
expressionPositions = [];
while (index < textLength) {
if (((startIndex = text.indexOf(self._startSymbol, index)) !== -1) &&
((endIndex = text.indexOf(self._endSymbol, startIndex + startSymbolLength)) !== -1)) {
if (index !== startIndex) {
concat.push(unescapeText(text.substring(index, startIndex)));
}
exp = text.substring(startIndex + startSymbolLength, endIndex);
expressions.push(exp);
parseFns.push($parse(exp, parseStringifyInterceptor));
index = endIndex + endSymbolLength;
expressionPositions.push(concat.length);
concat.push('');
} else {
// we did not find an interpolation, so we have to add the remainder to the separators array
if (index !== textLength) {
concat.push(unescapeText(text.substring(index)));
}
break;
}
}
if (trustedContext && concat.length > 1) {
$interpolateMinErr.throwNoconcat(text);
}
if (!mustHaveExpression || expressions.length) {
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];
}
return concat.join('');
};
var getValue = function (value) {
return trustedContext ?
$sce.getTrusted(trustedContext, value) :
$sce.valueOf(value);
};
return angular.extend(function interpolationFn(context) {
var i = 0;
var ii = expressions.length;
var values = new Array(ii);
try {
for (; i < ii; i++) {
values[i] = parseFns[i](context);
}
return compute(values);
} 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,
});
}
function parseStringifyInterceptor(value) {
try {
value = getValue(value);
return allOrNothing && !isDefined(value) ? value : stringify(value);
} catch (err) {
$exceptionHandler($interpolateMinErr.interr(text, err));
}
}
}
$interpolate.startSymbol = function () {
return startSymbol;
};
$interpolate.endSymbol = function () {
return endSymbol;
};
return $interpolate;
}
$get.$inject = ['$parse', '$exceptionHandler', '$sce'];
export class Interpolate
{
constructor () {
this._startSymbol='*[';
this._endSymbol = ']*';
}
set startSymbol (value) {
if (value) {
this._startSymbol = value;
return this;
} else {
return this._startSymbol;
}
};
set endSymbol (value) {
if (value) {
this._endSymbol = value;
return this;
} else {
return this._endSymbol;
}
};
}
Interpolate.prototype.$get = $get;
var interpolate = new Interpolate();
module.provider(NAME, () => interpolate);
import {module} from './module';
import {ng} from 'vendor';
import * as util from './util';
export const NAME = util.getProviderName('interpolate');
function minErr() {}
function stringify(value) {
if (value === null) { // null || undefined
return '';
}
switch (typeof value) {
case 'string':
break;
case 'number':
value = String(value);
break;
default:
value = angular.toJson(value);
}
return value;
}
var $interpolateMinErr = ng.angular.$interpolateMinErr = ng.$$minErr('$interpolate');
$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) {
return $interpolateMinErr('interr', 'Can\'t interpolate: {0}\n{1}', text, err.toString());
};
function $get($parse, $exceptionHandler, $sce) {
var startSymbolLength = this._startSymbol.length,
endSymbolLength = this._endSymbol.length,
escapedStartRegexp = new RegExp(this._startSymbol.replace(/./g, escape), 'g'),
escapedEndRegexp = new RegExp(this._endSymbol.replace(/./g, escape), 'g'),
self = this;
function escape(ch) {
return '\\\\\\' + ch;
}
function unescapeText(text) {
return text.replace(escapedStartRegexp, self._startSymbol)
.replace(escapedEndRegexp, self._endSymbol);
}
// TODO: this is the same as the constantWatchDelegate in parse.js
function constantWatchDelegate(scope, listener, objectEquality, constantInterp) {
var unwatch = scope.$watch(function constantInterpolateWatch(scope) {
unwatch();
return constantInterp(scope);
}, listener, objectEquality);
return unwatch;
}
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) {
var constantInterp;
if (!mustHaveExpression) {
var unescapedText = unescapeText(text);
constantInterp = valueFn(unescapedText);
constantInterp.exp = text;
constantInterp.expressions = [];
constantInterp.$$watchDelegate = constantWatchDelegate;
}
return constantInterp;
}
allOrNothing = Boolean(allOrNothing);
var startIndex,
endIndex,
index = 0,
expressions = [],
parseFns = [],
textLength = text.length,
exp,
concat = [],
expressionPositions = [];
while (index < textLength) {
if (((startIndex = text.indexOf(self._startSymbol, index)) !== -1) &&
((endIndex = text.indexOf(self._endSymbol, startIndex + startSymbolLength)) !== -1)) {
if (index !== startIndex) {
concat.push(unescapeText(text.substring(index, startIndex)));
}
exp = text.substring(startIndex + startSymbolLength, endIndex);
expressions.push(exp);
parseFns.push($parse(exp, parseStringifyInterceptor));
index = endIndex + endSymbolLength;
expressionPositions.push(concat.length);
concat.push('');
} else {
// we did not find an interpolation, so we have to add the remainder to the separators array
if (index !== textLength) {
concat.push(unescapeText(text.substring(index)));
}
break;
}
}
if (trustedContext && concat.length > 1) {
$interpolateMinErr.throwNoconcat(text);
}
if (!mustHaveExpression || expressions.length) {
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];
}
return concat.join('');
};
var getValue = function(value) {
return trustedContext ?
$sce.getTrusted(trustedContext, value) :
$sce.valueOf(value);
};
return angular.extend(function interpolationFn(context) {
var i = 0;
var ii = expressions.length;
var values = new Array(ii);
try {
for (; i < ii; i++) {
values[i] = parseFns[i](context);
}
return compute(values);
} 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
});
}
function parseStringifyInterceptor(value) {
try {
value = getValue(value);
return allOrNothing && !isDefined(value) ? value : stringify(value);
} catch (err) {
$exceptionHandler($interpolateMinErr.interr(text, err));
}
}
}
$interpolate.startSymbol = function() {
return startSymbol;
};
$interpolate.endSymbol = function() {
return endSymbol;
};
return $interpolate;
}
$get.$inject = ['$parse', '$exceptionHandler', '$sce'];
export class Interpolate
{
constructor() {
this._startSymbol = '*[';
this._endSymbol = ']*';
}
set startSymbol(value) {
if (value) {
this._startSymbol = value;
return this;
} else {
return this._startSymbol;
}
}
set endSymbol(value) {
if (value) {
this._endSymbol = value;
return this;
} else {
return this._endSymbol;
}
}
}
Interpolate.prototype.$get = $get;
var interpolate = new Interpolate();
module.provider(NAME, () => interpolate);

View File

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

View File

@ -1,39 +1,39 @@
import {module as _module} from './module';
import * as util from './util';
import constant from './constants';
import Interpolate from './interpolate';
export const NAME = util.getProviderName('ResolveDefaultComponent');
function $get($injector, vnInterpolate){
return {
getTemplate:function(name, attrs) {
this._frameworkName = 'Mdl';
let _name = util.getFactoryName( name + this._frameworkName);
let defaultfactory = $injector.has(_name) ? $injector.get(_name) : undefined;
if(!defaultfactory) {
throw new Error("factory is not defined");
}
let defaultValues = defaultfactory.default;
let template = defaultfactory.template;
let scope = Object.assign({}, defaultValues || {}, attrs || {});
return template && vnInterpolate(template)(scope);
}
};
}
$get.$inject = ['$injector', 'vnInterpolate'];
export class ResolveDefaultComponent {
constructor() {
this._frameworkName='Mdl';
}
set frameworkName(value) {
this._frameworkName = value;
}
}
ResolveDefaultComponent.prototype.$get = $get;
var resolve = new ResolveDefaultComponent();
_module.provider(NAME,() => resolve);
import {module as _module} from './module';
import * as util from './util';
import constant from './constants';
import Interpolate from './interpolate';
export const NAME = util.getProviderName('ResolveDefaultComponent');
function $get($injector, vnInterpolate) {
return {
getTemplate: function(name, attrs) {
this._frameworkName = 'Mdl';
let _name = util.getFactoryName(name + this._frameworkName);
let defaultfactory = $injector.has(_name) ? $injector.get(_name) : undefined;
if (!defaultfactory) {
throw new Error("factory is not defined");
}
let defaultValues = defaultfactory.default;
let template = defaultfactory.template;
let scope = Object.assign({}, defaultValues || {}, attrs || {});
return template && vnInterpolate(template)(scope);
}
};
}
$get.$inject = ['$injector', 'vnInterpolate'];
export class ResolveDefaultComponent {
constructor() {
this._frameworkName = 'Mdl';
}
set frameworkName(value) {
this._frameworkName = value;
}
}
ResolveDefaultComponent.prototype.$get = $get;
var resolve = new ResolveDefaultComponent();
_module.provider(NAME, () => resolve);

View File

@ -1,27 +1,27 @@
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){
let script = document.currentScript || (() => {
let scripts = document.getElementsByTagName ('script');
return scripts[scripts.length - 1];
}) ();
let routesCdn = script.getAttribute ('routes-cdn');
return $http({
method: 'GET',
url: routesCdn
});
function $get($http) {
let script = document.currentScript || (() => {
let scripts = document.getElementsByTagName('script');
return scripts[scripts.length - 1];
})();
let routesCdn = script.getAttribute('routes-cdn');
return $http({
method: 'GET',
url: routesCdn
});
}
$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) {
var _dependency = getDependency();
loadDependency(_dependency);
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

@ -1,20 +1,20 @@
import {module as _module} from '../module';
import * as resolveFactory from '../resolveDefaultComponents';
import * as normalizerFactory from '../inputAttrsNormalizer';
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);
return resolve.getTemplate(_NAME, attrs);
}
}
}
_module.directive(NAME,directive);
import {module as _module} from '../module';
import * as resolveFactory from '../resolveDefaultComponents';
import * as normalizerFactory from '../inputAttrsNormalizer';
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);
return resolve.getTemplate(_NAME, attrs);
}
};
}
_module.directive(NAME, directive);

View File

@ -1,25 +1,25 @@
import {module as _module} from '../module';
import * as util from '../util';
import * as constant from '../constants';
import template from './textfield.mdl.html';
const _NAME = 'textfield';
const DEFAULT_LABEL = 'text';
const DEFAULT_CLASS = 'mdl-textfield__input';
const DEFAULT_TYPE = 'text';
export const NAME = util.getFactoryName(_NAME + constant.MATERIAL_DESIGN_FRAMEWORK);
export function factory() {
return {
template: template,
default: {
label: DEFAULT_LABEL,
name: 'textfield',
className: DEFAULT_CLASS,
type: DEFAULT_TYPE
}
}
}
_module.factory(NAME, factory);
import {module as _module} from '../module';
import * as util from '../util';
import * as constant from '../constants';
import template from './textfield.mdl.html';
const _NAME = 'textfield';
const DEFAULT_LABEL = 'text';
const DEFAULT_CLASS = 'mdl-textfield__input';
const DEFAULT_TYPE = 'text';
export const NAME = util.getFactoryName(_NAME + constant.MATERIAL_DESIGN_FRAMEWORK);
export function factory() {
return {
template: template,
default: {
label: DEFAULT_LABEL,
name: 'textfield',
className: DEFAULT_CLASS,
type: DEFAULT_TYPE
}
};
}
_module.factory(NAME, factory);

View File

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