Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
Vikas Burman authored and Vikas Burman committed May 11, 2019
1 parent 2ffc08d commit c238007
Show file tree
Hide file tree
Showing 20 changed files with 98 additions and 96 deletions.
82 changes: 41 additions & 41 deletions dist/flair.app.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/flair.app.min.js

Large diffs are not rendered by default.

Binary file modified dist/flair.app.min.js.gz
Binary file not shown.
8 changes: 4 additions & 4 deletions dist/flair.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*
* Assembly: flair
* File: ./flair.js
* Version: 0.6.6
* Sat, 11 May 2019 03:36:56 GMT
* Version: 0.6.7
* Sat, 11 May 2019 03:55:11 GMT
*
* (c) 2017-2019 Vikas Burman
* MIT
Expand Down Expand Up @@ -105,10 +105,10 @@
name: 'flairjs',
title: 'Flair.js',
file: currentFile,
version: '0.6.6',
version: '0.6.7',
copyright: '(c) 2017-2019 Vikas Burman',
license: 'MIT',
lupdate: new Date('Sat, 11 May 2019 03:36:56 GMT')
lupdate: new Date('Sat, 11 May 2019 03:55:11 GMT')
});

flair.members = [];
Expand Down
6 changes: 3 additions & 3 deletions dist/flair.min.js

Large diffs are not rendered by default.

Binary file modified dist/flair.min.js.gz
Binary file not shown.
4 changes: 2 additions & 2 deletions dist/preamble.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions docs/v1/examples/js/flair.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*
* Assembly: flair
* File: ./flair.js
* Version: 0.6.6
* Sat, 11 May 2019 03:36:56 GMT
* Version: 0.6.7
* Sat, 11 May 2019 03:55:11 GMT
*
* (c) 2017-2019 Vikas Burman
* MIT
Expand Down Expand Up @@ -105,10 +105,10 @@
name: 'flairjs',
title: 'Flair.js',
file: currentFile,
version: '0.6.6',
version: '0.6.7',
copyright: '(c) 2017-2019 Vikas Burman',
license: 'MIT',
lupdate: new Date('Sat, 11 May 2019 03:36:56 GMT')
lupdate: new Date('Sat, 11 May 2019 03:55:11 GMT')
});

flair.members = [];
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"title": "Flair.js",
"description": "True Object Oriented JavaScript",
"copyright": "(c) 2017-2019 Vikas Burman",
"version": "0.6.6",
"version": "0.6.7",
"author": "Vikas Burman <[email protected]>",
"keywords": [
"javascript",
Expand Down
30 changes: 15 additions & 15 deletions src/flair.app/flair.app/ClientHost.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,26 @@ Class('(auto)', Host, function() {
// localization support (start)
$$('state');
$$('private');
this.currentLocale = settings.i18n.locale;
this.currentLocale = settings.client.i18n.locale;

this.defaultLocale = {
get: () => { return settings.i18n.locale; },
get: () => { return settings.client.i18n.locale; },
set: noop
};
this.supportedLocales = {
get: () => { return settings.i18n.locales.slice(); },
get: () => { return settings.client.i18n.locales.slice(); },
set: noop
};
this.locale = (newLocale, isSuppressRefresh) => {
if (!settings.i18n.enabled) { return ''; }
if (!settings.client.i18n.enabled) { return ''; }

// update value and refresh for changes (if required)
if (newLocale && this.currentLocale !== newLocale) {
this.currentLocale = newLocale;

// change url and then redirect to new URL
if (!isSuppressRefresh) {
if (settings.url.i18n) {
if (settings.client.url.i18n) {
// set new path with replaced locale
// this change will also go in history
window.location.hash = this.replaceLocale(window.location.hash);
Expand Down Expand Up @@ -76,7 +76,7 @@ Class('(auto)', Host, function() {
};
$$('private');
this.extractLocale = (path) => {
if (!settings.url.i18n) { return ''; }
if (!settings.client.url.i18n) { return ''; }

// pick first path element
let idx = path.indexOf('/');
Expand All @@ -102,7 +102,7 @@ Class('(auto)', Host, function() {
$$('private');
this.replaceLocale = (path) => {
// replace current locale with given locale
if (settings.url.i18n) {
if (settings.client.url.i18n) {
// clean path first
path = this.cleanPath(path);

Expand All @@ -128,14 +128,14 @@ Class('(auto)', Host, function() {
path = this.cleanPath(path);

// add hash
if (settings.url.hashbang) {
if (settings.client.url.hashbang) {
path = '/#!/' + path;
} else {
path = '/#/' + path;
}

// add i18n
if (settings.i18n.enabled && settings.url.i18n) {
if (settings.client.i18n.enabled && settings.client.url.i18n) {
path = (this.currentLocale || this.defaultLocale) + '/' + path;
}

Expand Down Expand Up @@ -191,7 +191,7 @@ Class('(auto)', Host, function() {
// each item is: { name: '', value: }
// name: as in above link (as-is)
// value: as defined in above link
let pageOptions = settings[`${mountName}-options`];
let pageOptions = settings.client.routing[`${mountName}-options`];
if (pageOptions && pageOptions.length > 0) {
for(let pageOption of pageOptions) {
appOptions[pageOption.name] = pageOption.value;
Expand All @@ -217,13 +217,13 @@ Class('(auto)', Host, function() {
mainApp.base('/');

// create one instance of page app for each mounted path
for(let mountName of Object.keys(settings.routing.mounts)) {
for(let mountName of Object.keys(settings.client.routing.mounts)) {
if (mountName === 'main') {
mountPath = '/';
mount = mainApp;
} else {
appOptions = getOptions(mountName);
mountPath = settings.routing.mounts[mountName];
mountPath = settings.client.routing.mounts[mountName];
mount = page.create(appOptions); // create a sub-app
mount.strict(appOptions.strict);
mount.base(mountPath);
Expand All @@ -250,8 +250,8 @@ Class('(auto)', Host, function() {
let path = this.cleanPath(window.location.hash);

// handle i18n specific routing
if (settings.i18n.enabled) {
if (settings.url.i18n) { // if i18n type urls are being used
if (settings.client.i18n.enabled) {
if (settings.client.url.i18n) { // if i18n type urls are being used
// extract locale from path
let extractedLocale = this.extractLocale(path);

Expand Down Expand Up @@ -310,7 +310,7 @@ Class('(auto)', Host, function() {
window.addEventListener('hashchange', hashChangeHandler);

// navigate to home
this.app.redirect(settings.url.home);
this.app.redirect(settings.client.url.home);

// ready
console.log(`${AppDomain.app().info.name}, v${AppDomain.app().info.version}`); // eslint-disable-line no-console
Expand Down
10 changes: 5 additions & 5 deletions src/flair.app/flair.app/ServerHost.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Class('(auto)', Host, function() {
let mountedApps = {},
httpServer = null,
httpsServer = null,
httpSettings = settings.express['server-http'],
httpsSettings = settings.express['server-https'];
httpSettings = settings.server.express['server-http'],
httpsSettings = settings.server.express['server-https'];

$$('override');
this.construct = (base) => {
Expand All @@ -38,7 +38,7 @@ Class('(auto)', Host, function() {
// each item is: { name: '', value: }
// name: as in above link (as-is)
// value: as defined in above link
let appSettings = settings[`${mountName}-appSettings`];
let appSettings = settings.server.routing[`${mountName}-appSettings`];
if (appSettings && appSettings.length > 0) {
for(let appSetting of appSettings) {
mount.set(appSetting.name, appSetting.value);
Expand All @@ -53,12 +53,12 @@ Class('(auto)', Host, function() {
// create one instance of express app for each mounted path
let mountPath = '',
mount = null;
for(let mountName of Object.keys(settings.routing.mounts)) {
for(let mountName of Object.keys(settings.server.routing.mounts)) {
if (mountName === 'main') {
mountPath = '/';
mount = mainApp;
} else {
mountPath = settings.routing.mounts[mountName];
mountPath = settings.server.routing.mounts[mountName];
mount = express(); // create a sub-app
}

Expand Down
4 changes: 2 additions & 2 deletions src/flair.app/flair.boot/ClientRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Class('(auto)', Bootware, function () {
// each interceptor is derived from ViewInterceptor and
// run method of it takes ctx, can update it
// each item is: "InterceptorTypeQualifiedName"
let mountInterceptors = settings[`${mount.name}-interceptors`] || [];
let mountInterceptors = settings.client.routing[`${mount.name}-interceptors`] || [];
runInterceptors(mountInterceptors, ctx).then(() => {
if (!ctx.$stop) {
handleRoute();
Expand All @@ -135,7 +135,7 @@ Class('(auto)', Bootware, function () {
// catch 404 for this mount and forward to error handler
mount.app("*", (ctx) => { // mount.app = page object/func
// redirect to 404 route, which has to be defined route
let url404 = settings.url['404'];
let url404 = settings.client.url['404'];
if (url404) {
ctx.handled = true;
if (ctx.pathname !== url404) {
Expand Down
2 changes: 1 addition & 1 deletion src/flair.app/flair.boot/Middlewares.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Class('(auto)', Bootware, function() {
// define it as: "return (res, path, stat) => { res.set('x-timestamp', Date.now()) }"
// this string will be passed to new Function(...) and returned values will be used as value of option
// all object type arguments will be scanned for string values that start with 'return ' and will be tried to convert into a function
let middlewares = settings[`${mount.name}-middlewares`];
let middlewares = settings.server.routing[`${mount.name}-middlewares`];
if (middlewares && middlewares.length > 0) {
let mod = null,
func = null;
Expand Down
6 changes: 3 additions & 3 deletions src/flair.app/flair.boot/NodeEnv.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ Class('(auto)', Bootware, function() {
this.boot = async (base) => {
base();

if (settings.envVars.vars.length > 0) {
if (settings.server.nsenvVars.vars.length > 0) {
const nodeEnv = await include('node-env-file | x');

if (nodeEnv) {
for(let envVar of settings.envVars.vars) {
nodeEnv(AppDomain.resolvePath(envVar), settings.envVars.options);
for(let envVar of settings.server.envVars.vars) {
nodeEnv(AppDomain.resolvePath(envVar), settings.server.envVars.options);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/flair.app/flair.boot/ServerRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Class('(auto)', Bootware, function () {
// each interceptor is derived from RestInterceptor and
// run method of it takes req, can update it, also takes res method and can generate response, in case request is being stopped
// each item is: "InterceptorTypeQualifiedName"
let mountInterceptors = settings[`${mount.name}-interceptors`] || [];
let mountInterceptors = settings.server.routing[`${mount.name}-interceptors`] || [];
runInterceptors(mountInterceptors, req, res).then(() => {
if (!req.$stop) {
handleRoute();
Expand Down
4 changes: 2 additions & 2 deletions src/flair.app/flair.ui.vue/@3-VueComponentMembers.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Mixin('(auto)', function() {
// each i18n resource file is defined as:
// "ns": "json-file-name"
// when loaded, each ns will convert into JSON object from defined file
if(settings.i18n.enabled && this.i18n) {
if(settings.client.i18n.enabled && this.i18n) {
let i18ResFile = '';
for(let i18nNs in this.i18n) {
if (this.i18n.hasOwnProperty(i18nNs)) {
Expand Down Expand Up @@ -122,7 +122,7 @@ Mixin('(auto)', function() {
component.methods['route'] = (routeName, placeholders) => { return _this.route(routeName, placeholders); };

// i18n specific built-in methods
if (settings.i18n.enabled) {
if (settings.client.i18n.enabled) {
// supporting built-in method: locale
// e.g., {{ locale() }} will give: 'en'
component.methods['locale'] = (value) => { return _this.locale(value); };
Expand Down
4 changes: 2 additions & 2 deletions src/flair.app/flair.ui.vue/VuePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ $$('ns', '(auto)');
Class('(auto)', function() {
this.construct = (name) => {
// load options, if name and corresponding options are defined
if (settings.vue.pluginOptions[name]) {
this.options = Object.assign({}, settings.vue.pluginOptions[name]); // keep a copy
if (settings.client.vue.pluginOptions[name]) {
this.options = Object.assign({}, settings.client.vue.pluginOptions[name]); // keep a copy
}
};

Expand Down
10 changes: 5 additions & 5 deletions src/flair.app/flair.ui.vue/VueSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Class('(auto)', Bootware, function() {
// load Vue global plugins
// each plugin in array is defined as:
// { "name": "name", "type": "ns.typeName" }
let plugins = settings.vue.plugins,
let plugins = settings.client.vue.plugins,
PluginType = null,
plugin = null;
for(let item of plugins) {
Expand All @@ -47,7 +47,7 @@ Class('(auto)', Bootware, function() {
// load Vue global mixins
// each mixin in array is defined as:
// { "name": "name", "type": "ns.typeName" }
let mixins = settings.vue.mixins,
let mixins = settings.client.vue.mixins,
MixinType = null,
mixin = null;
for(let item of mixins) {
Expand All @@ -70,7 +70,7 @@ Class('(auto)', Bootware, function() {
// load Vue global directives
// each directive in array is defined as:
// { "name": "name", "type": "ns.typeName" }
let directives = settings.vue.directives,
let directives = settings.client.vue.directives,
DirectiveType = null,
directive = null;
for(let item of directives) {
Expand All @@ -93,7 +93,7 @@ Class('(auto)', Bootware, function() {
// load Vue global filters
// each filter in array is defined as:
// { "name": "name", "type": "ns.typeName" }
let filters = settings.vue.filters,
let filters = settings.client.vue.filters,
FilterType = null,
filter = null;
for(let item of filters) {
Expand All @@ -116,7 +116,7 @@ Class('(auto)', Bootware, function() {
// register global components
// each component in array is defined as:
// { "name": "name", "type": "ns.typeName" }
let components = settings.vue.components,
let components = settings.client.vue.components,
ComponentType = null,
component = null;
for(let item of components) {
Expand Down
2 changes: 1 addition & 1 deletion src/flair.app/flair.ui.vue/VueView.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Class('(auto)', ViewHandler, [VueComponentMembers], function() {

$$('override');
this.construct = (base) => {
base(settings.view.el, settings.view.title, settings.view.transition);
base(settings.client.view.el, settings.client.view.title, settings.client.view.transition);
};

$$('private');
Expand Down
4 changes: 3 additions & 1 deletion src/flair.app/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@
"main-middlewares": [
],
"main-interceptors": [
]
],
"main-resHeaders": [
]
}
}
}

0 comments on commit c238007

Please sign in to comment.