Plantilla proyecto inicial

This commit is contained in:
jgallego 2016-09-29 11:04:11 +02:00
parent ee100502df
commit aa85fade20
31 changed files with 136 additions and 138 deletions

View File

@ -1,6 +1,10 @@
{ {
"name": "@salix/app", "name": "@salix/app",
"version": "1.0.0", "version": "0.0.0",
"description": "", "description": "",
"main": "index.js" "main": "index.js",
"repository": {
"type": "git",
"url": "http://git.verdnatura.es:/salix"
}
} }

View File

@ -1,2 +1 @@
export {NAME} from './module' import {ng} from '@salix/vendor'
export * from './config'

View File

@ -1,6 +0,0 @@
import {module} from './module';
config.$inject = [];
export function config(){
}
module.config(config);

View File

@ -1,5 +0,0 @@
import {ng} from '@salix/vendor';
import * as core from '@salix/core';
export const NAME="vnapp";
export const module=ng.module(NAME,[]);

View File

@ -1,4 +1,2 @@
import * as vendor from '@salix/vendor';
export * from './src/core' export * from './src/core'

View File

@ -1,9 +1,10 @@
{ {
"name": "@salix/core", "name": "@salix/core",
"version": "1.0.0", "version": "0.0.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"dependencies": { "repository": {
"angular": "^1.5.8" "type": "git",
"url": "http://git.verdnatura.es:/salix"
} }
} }

View File

@ -1,3 +0,0 @@
<button type = "button" class="{{className}}" {{enabled}} >
<i class="material-icons">{{icon}} </i>
</button>

View File

@ -1,20 +0,0 @@
import coremodule from '../coremodule';
import util from '../util';
import constant from '../constants';
const DEFAULT_BUTTON = ''; // clase css bootstrap. Pendiente de definir
const DEFAULT_TEXT = constant.BUTTON_NAME;
export const NAME = util.getFactoryName(constant.BUTTON_NAME + constant.BOOTSTRAPFRAMEWORK)
export function factoryBt(){
return{
texto: DEFAULT_TEXT,
className: DEFAULT_BUTTON,
enabled: 'true',
typeName: 'button'
}
};
coremodule.factory(NAME,factoryBt);

View File

@ -0,0 +1,24 @@
import {module as _module} from '../module';
import * as util from '../util';
import * as constant from '../constants';
import template from './button.bt.html';
const DEFAULT_CLASS = ''; // clase css bootstrap. Pendiente de definir
const DEFAULT_TEXT = constant.BUTTON_NAME;
export const NAME = util.getFactoryName(constant.BUTTON_NAME + constant.BOOTSTRAPFRAMEWORK) //vnbuttonmtFactory
export function factory() {
return {
template: template,
default: {
texto: DEFAULT_TEXT,
className: DEFAULT_CLASS,
enabled: 'true',
typeName: 'button'
}
}
};
_module.factory(NAME, factory);

View File

@ -1,22 +1,20 @@
import coremodule from '../coremodule'; import {module as _module} from '../module';
import resolveFactory from '../resolveDefaultFactoryComponents'; import * as resolveFactory from '../resolveDefaultComponents';
import constant from '../constants'; import {BUTTON_NAME} from '../constants';
import interpolate from '../interpolate'; import * as util from '../util';
import util from '../util';
const NAME = util.getName(constant.BUTTON_NAME); export const NAME = util.getName(BUTTON_NAME);
buttonDirective.$inject =[resolveFactory.NAME,interpolate.NAME]; directive.$inject =[resolveFactory.NAME];
export function buttonDirective (resolve,vninterpolate){ export function directive (resolve){
return{ return{
require:'E', require:'E',
template: function(_,attr){ template: function(_,attr){
var scope= Object.assign(resolve.button,attrs); return resolve.getTemplate(BUTTON_NAME,attr);
// return vninterpolate(require(util.getTemplateName(constant.BUTTON_NAME,resolve.name))(scope);
} }
} }
} }
coremodule.directive(NAME,buttonDirective); _module.directive(NAME,directive);

View File

@ -1,20 +0,0 @@
import coremodule from '../coremodule';
import util from '../util';
import constant from '../constants';
const DEFAULT_BUTTON = 'mdl-button mdl-js-button mdl-button--raised';
const DEFAULT_TEXT = constant.BUTTON_NAME;
export const NAME = util.getFactoryName(constant.BUTTON_NAME + constant.MATERIALDESIGNFRAMEWORK); //buttonmtFactory
export function factoryMt(){
return{
texto: DEFAULT_TEXT,
className: DEFAULT_BUTTON,
enabled: 'true',
typeName: 'button'
}
};
coremodule.factory(NAME,factoryMt);

View File

@ -0,0 +1,24 @@
import {module as _module} from '../module';
import * as util from '../util';
import * as constant from '../constants';
import template from './button.mt.html';
const DEFAULT_CLASS = 'mdl-button mdl-js-button mdl-button--raised';
const DEFAULT_TEXT = constant.BUTTON_NAME;
export const NAME = util.getFactoryName(constant.BUTTON_NAME + constant.MATERIALDESIGNFRAMEWORK); //buttonmtFactory
export function factoryMt() {
return {
template: template,
default: {
texto: DEFAULT_TEXT,
className: DEFAULT_CLASS,
enabled: 'true',
typeName: 'button'
}
}
};
_module.factory(NAME, factoryMt);

View File

@ -1,4 +0,0 @@
<label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="checkbox-1">
<input type="checkbox" id="{{model}}" class="mdl-checkbox__input" checked>
<span class="mdl-checkbox__label">Checkbox</span>
</label>

View File

@ -6,3 +6,5 @@ export const BOOTSTRAP_FRAMEWORK = 'bt';
// directive name // directive name
export const BUTTON_NAME ='button'; export const BUTTON_NAME ='button';
export const BUTTON_ICON_NAME ='buttonIcon'; export const BUTTON_ICON_NAME ='buttonIcon';
//dependency module
export const EMPTYDEPENDECIES=[];

View File

@ -1,4 +1,10 @@
/** /**
* export public module * export public module
*/ */
export {NAME} from './coremodule'; export {NAME} from './module';
export * from './util';
export {NAME as RESOLVEDEFAULTCOMPONENT, ResolveDefaultComponent} from './resolveDefaultComponents'
export {NAME as INTERPOLATE,Interpolate} from './interpolate'
export {NAME as BUTTON,directive as ButtonDirective} from './button/button'
export {NAME as BUTTONMT,factory as buttonmt} from './button/button.mt'
export {NAME as BUTTONBT,factory as buttonbt} from './button/button.bt'

View File

@ -1,10 +0,0 @@
import angular from 'angular'
import util from './util'
const DEPENDENCIES ='[]'
export const NAME = util.getModuleName('core');
let moduleCore = angular.module(NAME,DEPENDENCIES);
export default moduleCore;

View File

@ -1,5 +1,5 @@
import coremodule from './coremodule'; import {module as _module} from './module';
import util from './util'; import * as util from './util';
export const NAME = util.getProviderName('interpolate'); export const NAME = util.getProviderName('interpolate');
@ -164,4 +164,4 @@ export class Interpolate
} }
coremodule.provider(NAME,interpolate); _module.provider(NAME,Interpolate);

View File

@ -0,0 +1,9 @@
import {ng} from '@salix/vendor';
import {EMPTYDEPENDECIES} from './constants';
import {getModuleName} from './util';
export const NAME = getModuleName('core');
export const module = ng.module(NAME,EMPTYDEPENDECIES);

View File

@ -1,3 +0,0 @@
<button class="">
Button
</button>

View File

@ -1,6 +1,7 @@
import coremodule from './coremodule'; import {module as _module} from './module';
import util from './util'; import * as util from './util';
import constant from './constants'; import constant from './constants';
import interpolate from './interpolate';
export const NAME = util.getProviderName('ResolveDefaultComponent'); export const NAME = util.getProviderName('ResolveDefaultComponent');
@ -9,20 +10,28 @@ export class ResolveDefaultComponent {
constructor(){ constructor(){
this._name="mt"; this._name="mt";
} }
set frameworkName(name){ set frameworkName(value){
//mt or bt //mt or bt
this._name = name; this._frameworkName = value;
} }
$get($injector){ $get($injector,interpolate){
//Service Locator //Service Locator
return { return {
button:function(){ getTemplate:function(name ,attr){
return $injector.get(util.getFactoryName(constant.BUTTON_NAME + this._name)); // butonmtFactory let _name = util.getFactoryName( name + this._frameworkName);
}, let defaultfactory = $injector.has(_name) ? $injector.get():undefined; // vnbutonmtFactory
name : this._name if(!defaultfactory)
{
throw new Error("factoty is not defined");
}
let defaultValues = defaultfactory.default;
let template = defaultfactory.template;
let scope = Object.assign(defaultValues || {},attr||{});
return template && interpolate(template)(scope);
}
}; };
} }
} }
coremodule.provider(NAME,ResolveDefaultComponent) _module.provider(NAME,ResolveDefaultComponent)

View File

@ -1,3 +0,0 @@
<button class="">
Button
</button>

View File

@ -1,3 +0,0 @@
<button class="">
Button
</button>

View File

@ -1,4 +1,4 @@
import constant from './constants'; import * as constant from './constants';
const FACTORY = 'Factory'; const FACTORY = 'Factory';
const SERVICE = 'Service'; const SERVICE = 'Service';

View File

@ -1 +1 @@
import * as vendor from './src/vendor'; export * from './src/vendor';

View File

@ -1,10 +1,9 @@
{ {
"name": "@salix/vendor", "name": "@salix/vendor",
"version": "1.0.0", "version": "0.0.0",
"description": "", "description": "",
"dependencies": { "repository": {
"angular": "^1.5.8", "type": "git",
"angular-ui-router": "^0.3.1", "url": "http://git.verdnatura.es:/salix"
"oclazyload": "^1.0.9"
} }
} }

View File

@ -1,6 +1,6 @@
import * as angular from 'angular'; import * as _angular from 'angular';
export const ng = { export const ng = {
module: angular.module, module: _angular.module,
bootstrap: angular.bootstrap bootstrap: _angular.bootstrap
} }

View File

@ -1,7 +1,7 @@
import * as oclazyload from 'oclazyload'; import * as _oclazyload from 'oclazyload';
import {getComponentName} from './util'; import {getComponentName} from './util';
export const oclazyloadVendor = { export const oclazyload = {
name: 'oc.lazyLoad', name: 'oc.lazyLoad',
oclazyload: getComponentName('$ocLazyLoad') oclazyload: getComponentName('$ocLazyLoad',true)
} }

View File

@ -1,7 +1,7 @@
import * as angularuirouter from 'angular-ui-router'; import * as _uirouter from 'angular-ui-router';
import {getComponentName} from './util'; import {getComponentName} from './util';
export const uirouter = { export const uirouter = {
name: 'ui.router', name: 'ui.router',
state: getComponentName('$state') state: getComponentName('$state',true)
} }

View File

@ -3,7 +3,12 @@
<head> <head>
<title>Salix</title> <title>Salix</title>
</head> </head>
<div id ="app">
</div>
<body> <body>
<script type="text/javascript" src="build/salix.vendor.js"></script>
<script type="text/javascript" src="build/salix.core.js"></script>
<script type="text/javascript" src="build/salix.app.js"></script> <script type="text/javascript" src="build/salix.app.js"></script>
</body> </body>
</html> </html>

View File

@ -9,7 +9,9 @@
"url": "http://git.verdnatura.es:/salix" "url": "http://git.verdnatura.es:/salix"
}, },
"dependencies": { "dependencies": {
"angular": "^1.5.8" "angular": "^1.5.8",
"angular-ui-router": "^0.3.1",
"oclazyload": "^1.0.9"
}, },
"devDependencies": { "devDependencies": {
"webpack": "*", "webpack": "*",
@ -17,13 +19,9 @@
"babel-core": "*", "babel-core": "*",
"babel-preset-es2015": "*", "babel-preset-es2015": "*",
"babel-loader": "*", "babel-loader": "*",
"css-loader": "*",
"file-loader": "*",
"json-loader": "*",
"style-loader": "*",
"raw-loader": "*" "raw-loader": "*"
}, },
"scripts": { "scripts": {
"build": "rm build/* ; webpack --progress --colors" "build": "webpack --progress --colors"
} }
} }

View File

@ -32,7 +32,6 @@ module.exports =
resolve: { resolve: {
modulesDirectories: [ modulesDirectories: [
__dirname, __dirname,
'src',
'node_modules' 'node_modules'
] ]
}, },