From 8860322bd831fbc37c56a8de4e8bb6a553e4e7fd Mon Sep 17 00:00:00 2001 From: sentivate Date: Wed, 2 Feb 2022 20:08:44 -0500 Subject: [PATCH] Refactor Router & Nav Components (breaking) --- .../filesystem/asset/Sentivate/index.js | 85 +- .../component/navigationBar/template.html | 2 +- .../filesystem/asset/component/page/index.js | 1 - .../filesystem/asset/models/batch/list.html | 6 +- .../filesystem/asset/models/batch/page.html | 10 +- .../asset/models/campaign/list.html | 6 +- .../filesystem/asset/models/code/list.html | 6 +- .../filesystem/asset/models/code/page.html | 8 +- .../asset/models/feedback/list.html | 18 +- .../asset/models/feedback/page.html | 2 +- .../filesystem/asset/models/login/page.html | 2 +- .../filesystem/asset/models/nft/list.html | 6 +- .../asset/models/organization/list.html | 6 +- .../filesystem/asset/models/product/list.html | 6 +- .../filesystem/asset/models/product/page.html | 10 +- .../filesystem/asset/models/signup/page.html | 2 +- .../asset/routes/batch/admin/index.js | 2 - .../asset/routes/batch/admin/template.html | 12 +- .../asset/routes/batch/operator/index.js | 2 - .../asset/routes/batch/owner/index.js | 2 - .../asset/routes/batches/operator/index.js | 2 - .../asset/routes/batches/owner/index.js | 2 - .../asset/routes/campaign/admin/index.js | 2 - .../asset/routes/campaign/operator/index.js | 2 - .../asset/routes/campaign/owner/index.js | 2 - .../asset/routes/campaigns/admin/index.js | 2 - .../asset/routes/campaigns/operator/index.js | 3 - .../asset/routes/campaigns/owner/index.js | 2 - .../asset/routes/code/admin/index.js | 2 - .../asset/routes/code/operator/index.js | 2 - .../asset/routes/code/owner/index.js | 2 - .../asset/routes/codes/admin/index.js | 2 - .../asset/routes/codes/operator/index.js | 2 - .../asset/routes/codes/owner/index.js | 2 - .../asset/routes/dash/admin/index.js | 1 - .../asset/routes/dash/admin/template.html | 2 +- .../asset/routes/dash/open/index.js | 1 - .../asset/routes/dash/operator/index.js | 1 - .../asset/routes/dash/operator/template.html | 4 +- .../asset/routes/dash/owner/index.js | 1 - .../asset/routes/dash/owner/template.html | 4 +- .../asset/routes/dash/user/index.js | 1 - .../asset/routes/dash/user/template.html | 2 +- .../filesystem/asset/routes/facility/index.js | 1 - .../asset/routes/facility/template.html | 4 +- .../routes/feedback/batch/owner/index.js | 2 - .../asset/routes/feedback/code/owner/index.js | 2 - .../asset/routes/feedback/operator/index.js | 2 - .../feedback/organization/owner/index.js | 2 - .../asset/routes/feedback/owner/index.js | 2 - .../asset/routes/feedback/page/owner/index.js | 2 - .../routes/feedback/product/owner/index.js | 2 - .../filesystem/asset/routes/login/index.js | 1 - .../asset/routes/nft/admin/index.js | 2 - .../filesystem/asset/routes/nft/index.js | 2 - .../asset/routes/nft/operator/index.js | 2 - .../asset/routes/nft/owner/index.js | 2 - .../filesystem/asset/routes/nft/user/index.js | 2 - .../asset/routes/organization/index.js | 1 - .../routes/organization/operator/index.js | 3 - .../asset/routes/organization/owner/index.js | 2 - .../asset/routes/organization/template.html | 6 +- .../asset/routes/organizations/index.js | 1 - .../asset/routes/organizations/template.html | 2 +- .../asset/routes/product/admin/index.js | 2 - .../asset/routes/product/admin/template.html | 6 +- .../asset/routes/product/operator/index.js | 2 - .../asset/routes/product/owner/index.js | 2 - .../asset/routes/products/operator/index.js | 2 - .../asset/routes/products/owner/index.js | 2 - .../asset/routes/qrcode/template.html | 2 +- .../asset/routes/settings/operator/index.js | 1 - .../routes/settings/operator/template.html | 2 +- .../filesystem/asset/routes/signup/index.js | 1 - .../filesystem/asset/routes/user/index.js | 1 - .../asset/routes/user/template.html | 2 +- .../example!/filesystem/public/Sentivate.js | 1160 +++++++++++++++-- uwBridge/system/compile/.vscode/settings.json | 1 + uwBridge/system/compile/build/front/bundle.js | 1160 +++++++++++++++-- .../system/compile/build/front/coreBundle.js | 1160 +++++++++++++++-- .../system/compile/build/socket/bundle.js | 1061 --------------- .../system/compile/build/socket/coreBundle.js | 1057 --------------- .../compile/build/socket/coreBundle.js.map | 1 - uwBridge/system/compile/index.js | 14 - .../system/compile/source/front/core/app.js | 11 + .../core}/component/asyncComponent.js | 0 .../core}/component/buildComponent.js | 0 .../core}/component/component.js | 1 + .../{socket => front/core}/component/css.js | 0 .../core}/component/defaultData.js | 0 .../core}/component/extendRactive.js | 0 .../core}/component/getComponentName.js | 0 .../core}/component/importPartials.js | 0 .../core}/component/importTemplate.js | 0 .../{socket => front/core}/component/index.js | 0 .../core}/component/initializeComponent.js | 0 .../core}/component/multiEvent.js | 0 .../core}/component/onConstruct.js | 0 .../core}/component/preventDefault.js | 2 +- .../{socket => front/core}/component/view.js | 0 .../core}/component/watch/css.js | 0 .../core}/component/watch/html.js | 0 .../compile/source/front/core/demand.js | 2 - .../compile/source/front/core/fetchFile.js | 6 +- .../system/compile/source/front/core/index.js | 4 + .../index.js => front/core/notifications.js} | 2 +- .../{socket/events => front/core}/resize.js | 2 +- .../compile/source/front/core/router.js | 224 ++++ .../system/compile/source/front/libs/index.js | 1 - .../source/front/libs/ractivePlugins.js | 0 uwBridge/system/compile/source/socket/app.js | 1 - .../compile/source/socket/core/index.js | 5 - .../compile/source/socket/events/index.js | 1 - .../compile/source/socket/libs/index.js | 1 - .../compile/source/socket/router/index.js | 1 - .../compile/source/socket/router/setup.js | 283 ---- .../compile/source/socket/security/index.js | 8 - 117 files changed, 3568 insertions(+), 2911 deletions(-) delete mode 100644 uwBridge/system/compile/build/socket/bundle.js delete mode 100644 uwBridge/system/compile/build/socket/coreBundle.js delete mode 100644 uwBridge/system/compile/build/socket/coreBundle.js.map rename uwBridge/system/compile/source/{socket => front/core}/component/asyncComponent.js (100%) rename uwBridge/system/compile/source/{socket => front/core}/component/buildComponent.js (100%) rename uwBridge/system/compile/source/{socket => front/core}/component/component.js (96%) rename uwBridge/system/compile/source/{socket => front/core}/component/css.js (100%) rename uwBridge/system/compile/source/{socket => front/core}/component/defaultData.js (100%) rename uwBridge/system/compile/source/{socket => front/core}/component/extendRactive.js (100%) rename uwBridge/system/compile/source/{socket => front/core}/component/getComponentName.js (100%) rename uwBridge/system/compile/source/{socket => front/core}/component/importPartials.js (100%) rename uwBridge/system/compile/source/{socket => front/core}/component/importTemplate.js (100%) rename uwBridge/system/compile/source/{socket => front/core}/component/index.js (100%) rename uwBridge/system/compile/source/{socket => front/core}/component/initializeComponent.js (100%) rename uwBridge/system/compile/source/{socket => front/core}/component/multiEvent.js (100%) rename uwBridge/system/compile/source/{socket => front/core}/component/onConstruct.js (100%) rename uwBridge/system/compile/source/{socket => front/core}/component/preventDefault.js (95%) rename uwBridge/system/compile/source/{socket => front/core}/component/view.js (100%) rename uwBridge/system/compile/source/{socket => front/core}/component/watch/css.js (100%) rename uwBridge/system/compile/source/{socket => front/core}/component/watch/html.js (100%) rename uwBridge/system/compile/source/{socket/notifications/index.js => front/core/notifications.js} (97%) rename uwBridge/system/compile/source/{socket/events => front/core}/resize.js (99%) create mode 100644 uwBridge/system/compile/source/front/core/router.js delete mode 100644 uwBridge/system/compile/source/front/libs/ractivePlugins.js delete mode 100644 uwBridge/system/compile/source/socket/app.js delete mode 100644 uwBridge/system/compile/source/socket/core/index.js delete mode 100644 uwBridge/system/compile/source/socket/events/index.js delete mode 100644 uwBridge/system/compile/source/socket/libs/index.js delete mode 100644 uwBridge/system/compile/source/socket/router/index.js delete mode 100644 uwBridge/system/compile/source/socket/router/setup.js delete mode 100644 uwBridge/system/compile/source/socket/security/index.js diff --git a/uwBridge/apps/client/example!/filesystem/asset/Sentivate/index.js b/uwBridge/apps/client/example!/filesystem/asset/Sentivate/index.js index 1be6c8e2..f4e3fb2b 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/Sentivate/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/Sentivate/index.js @@ -152,7 +152,7 @@ assignDeep, ensureArray: ensureArray$1, assign: assign$5, - each: each$9, + each: each$8, isArray: isArray$1, isEmpty, sortNewest, @@ -244,7 +244,7 @@ assignDeep(oldVal, newValArg); } else { const newVal = ensureArray$1(newValArg); - each$9(newVal, (item) => { + each$8(newVal, (item) => { const oldValItem = findItem(oldVal, item[indexName], indexName); if (hasValue(oldValItem)) { assign$5(oldValItem, item); @@ -289,7 +289,7 @@ watch: watch$2, demand: demand$3, utility: { - each: each$8, isFunction: isFunction$1 + each: each$7, isFunction: isFunction$1 }, crate } = app; @@ -310,7 +310,7 @@ if (isFunction$1(componentName)) { componentName(html); } else { - each$8(app.view.findAllComponents(componentName), (item) => { + each$7(app.view.findAllComponents(componentName), (item) => { if (app.debug) { console.log(item); } @@ -330,15 +330,15 @@ watch$2.html = watchHtml; const { utility: { - each: each$7 + each: each$6 } } = app; const importPartials = (componentName, componentModel, asset) => { if (asset.partials) { - each$7(asset.partials, (item, key) => { + each$6(asset.partials, (item, key) => { watchHtml(item.includes('.html') ? item : `${item}.html`, (html) => { const realName = getComponentName(componentModel, componentName); - each$7(app.view.findAllComponents(realName), (subItem) => { + each$6(app.view.findAllComponents(realName), (subItem) => { subItem.resetPartial(key, html); }); }); @@ -364,7 +364,7 @@ }; const { utility: { - each: each$6, isString: isString$3, isArray, apply: apply$2 + each: each$5, isString: isString$3, isArray, apply: apply$2 } } = app; const logMulti = console; @@ -385,15 +385,15 @@ } if (events) { if (isString$3(events)) { - each$6(events.split(','), (subItem) => { + each$5(events.split(','), (subItem) => { if (subItem) { currentView.fire(subItem.trim(), componentEvent, ...args); } }); } else if (isArray(events)) { - each$6(events, (item) => { + each$5(events, (item) => { if (item) { - each$6(item.split(','), (subItem) => { + each$5(item.split(','), (subItem) => { if (subItem) { currentView.fire(subItem.trim(), componentEvent, ...args); } @@ -405,7 +405,7 @@ }; const { utility: { - each: each$5, assign: assign$4, querySelector: querySelector$1 + each: each$4, assign: assign$4, querySelector: querySelector$1 } } = app; const headNode = querySelector$1('head'); @@ -435,12 +435,12 @@ }; const cssRender = (css) => { if (css) { - each$5(css, render); + each$4(css, render); } }; const cssUnrender = (css) => { if (css) { - each$5(css, unrender); + each$4(css, unrender); } }; const componentsWithCss = {}; @@ -448,7 +448,7 @@ if (!css) { return; } - each$5(css, (item, key) => { + each$4(css, (item, key) => { if (!componentsWithCss[key]) { componentsWithCss[key] = []; } @@ -463,7 +463,7 @@ const { watch: watch$1, utility: { - each: each$4, get, apply: apply$1 + each: each$3, get, apply: apply$1 } } = app; const createWatchers = (currentView, item, key) => { @@ -509,7 +509,7 @@ }; const removeInstance = function(currentView, css) { cssUnrender(css); - each$4(currentView.watchers, (item, key) => { + each$3(currentView.watchers, (item, key) => { item.stop(); item[key] = null; }); @@ -517,7 +517,7 @@ const onrenderInstance = function(currentView, css) { cssRender(css); if (currentView.watchers) { - each$4(currentView.watchers, (item) => { + each$3(currentView.watchers, (item) => { item.start(); }); } @@ -529,7 +529,7 @@ const thisComponent = this; thisComponent.watchers = watchers ? watchers(thisComponent) : {}; if (thisComponent.watchers) { - each$4(thisComponent.watchers, (item, key) => { + each$3(thisComponent.watchers, (item, key) => { createWatchers(thisComponent, item, key); }); } @@ -609,7 +609,7 @@ demandCss, demandHtml, utility: { - assign: assign$2, each: each$3, ensureArray, isString: isString$2 + assign: assign$2, each: each$2, ensureArray, isString: isString$2 } } = app; const asyncComponent = async function(componentConfig) { @@ -637,7 +637,7 @@ if (asset.css) { const assetCss = asset.css; const loadCss = await demandCss(assetCss); - each$3(ensureArray(loadCss), (item, index) => { + each$2(ensureArray(loadCss), (item, index) => { let keyName = assetCss[index]; if (!keyName.includes('.css')) { keyName = `${keyName}.css`; @@ -684,7 +684,7 @@ demand: demand$1, watch, utility: { - each: each$2, querySelector, isDom + each: each$1, querySelector, isDom } } = app; const onCss = async (json) => { @@ -699,7 +699,7 @@ node.innerHTML = content; } if (componentsUsingCss) { - each$2(componentsUsingCss, (item) => { + each$1(componentsUsingCss, (item) => { console.log(item); item.css[filePath] = content; }); @@ -710,7 +710,7 @@ const { demand, utility: { - assign: assign$1, each: each$1, isFunction + assign: assign$1, each, isFunction } } = app; const view = new Ractive({ @@ -728,7 +728,7 @@ const afterDemand = componentEvent.get('afterDemand'); if (afterDemand) { const afterDemandEvents = afterDemand[componentEvent.original.type]; - each$1(afterDemandEvents, (item, key) => { + each(afterDemandEvents, (item, key) => { if (isFunction(item)) { item(imported, item, key); } else { @@ -784,44 +784,11 @@ demandJs, demandLang, utility: { - cnsl, assign, each, map, isString, rest, camelCase, omit, last, batch, eventAdd, apply + cnsl, assign, mapArray, map, isString, rest, camelCase, omit, last, batch, eventAdd, apply, isRegExp, mapWhile } } = app; - const router = {}; - const hostname = window.location.hostname; - router.historyIndex = 0; - const logRouter = console; - function debugRouter(...args) { - if (app.debug || app.debugRouter) { - apply(logRouter.log, logRouter, args); - } - } - Ractive.sharedSet('historyIndex', router.historyIndex); cnsl('ROUTER ONLINE', 'important'); assign(router, { - add(item) { - each(item, router.addObject); - }, - addObject(item, key) { - const reg = new RegExp(key); - router.routes.push(async () => { - return router.routeChecker(item, reg); - }); - }, - attachEvents() { - eventAdd( - window, - 'popstate', - async (eventArg) => { - debugRouter('popstate', eventArg); - router.saveState(); - router.updateLocation(); - await router.loadState(); - eventArg.preventDefault(); - }, - true - ); - }, async closeState(previousStateObject) { debugRouter('closeState', previousStateObject); if (previousStateObject) { diff --git a/uwBridge/apps/client/example!/filesystem/asset/component/navigationBar/template.html b/uwBridge/apps/client/example!/filesystem/asset/component/navigationBar/template.html index 02787092..0e61e4e8 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/component/navigationBar/template.html +++ b/uwBridge/apps/client/example!/filesystem/asset/component/navigationBar/template.html @@ -24,7 +24,7 @@
{{#batch.feed}} -
@@ -49,7 +49,7 @@
- +
@@ -65,7 +65,7 @@
- +
diff --git a/uwBridge/apps/client/example!/filesystem/asset/models/batch/page.html b/uwBridge/apps/client/example!/filesystem/asset/models/batch/page.html index 76660953..db84cf98 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/models/batch/page.html +++ b/uwBridge/apps/client/example!/filesystem/asset/models/batch/page.html @@ -24,13 +24,13 @@

- + CODES: {{batch.current.codeCount}} - + SCANS: {{batch.current.scanCount}} - + FEEDBACK: {{batch.current.feedbackCount}} @@ -147,7 +147,7 @@

Batch Questions
{{/}}

- + {{batch.current.facilityData.name}} @@ -190,7 +190,7 @@

Facility Questions
{{/}}

- + {{batch.current.organizationData.name}} diff --git a/uwBridge/apps/client/example!/filesystem/asset/models/campaign/list.html b/uwBridge/apps/client/example!/filesystem/asset/models/campaign/list.html index 0ca13ecb..61170249 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/models/campaign/list.html +++ b/uwBridge/apps/client/example!/filesystem/asset/models/campaign/list.html @@ -34,7 +34,7 @@ {{#campaign.feed}} -
@@ -49,7 +49,7 @@
- +
@@ -65,7 +65,7 @@
- +
diff --git a/uwBridge/apps/client/example!/filesystem/asset/models/code/list.html b/uwBridge/apps/client/example!/filesystem/asset/models/code/list.html index ecd5cf30..947ac380 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/models/code/list.html +++ b/uwBridge/apps/client/example!/filesystem/asset/models/code/list.html @@ -34,7 +34,7 @@ {{#code.feed}} -
@@ -49,7 +49,7 @@
- +
@@ -65,7 +65,7 @@
- +
diff --git a/uwBridge/apps/client/example!/filesystem/asset/models/code/page.html b/uwBridge/apps/client/example!/filesystem/asset/models/code/page.html index 5e0852bd..260d4f5d 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/models/code/page.html +++ b/uwBridge/apps/client/example!/filesystem/asset/models/code/page.html @@ -19,12 +19,12 @@ {{/}}

- {{code.current.productData.name}} + {{code.current.productData.name}}

- NFT: {{code.current.hashString}} + NFT: {{code.current.hashString}}
@@ -60,7 +60,7 @@
Product Questions
{{/}}

- {{code.current.batchData.name}} + {{code.current.batchData.name}}

@@ -101,7 +101,7 @@
Batch Questions
{{/}}

- + {{code.current.organizationData.name}} diff --git a/uwBridge/apps/client/example!/filesystem/asset/models/feedback/list.html b/uwBridge/apps/client/example!/filesystem/asset/models/feedback/list.html index 7e551ca0..0bd878b9 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/models/feedback/list.html +++ b/uwBridge/apps/client/example!/filesystem/asset/models/feedback/list.html @@ -31,7 +31,7 @@

{{#feedback.feed}} -
@@ -43,22 +43,22 @@
{{#product}}
- +
{{/}} {{#batch}}
- +
{{/}} {{#organization && !product && !batch && !facility}}
- +
{{/}} {{#creator}}
- +
{{/}}
@@ -71,22 +71,22 @@
{{#product}}
- +
{{/}} {{#batch}}
- +
{{/}} {{#organization}}
- +
{{/}} {{#creator}}
- +
{{/}}
diff --git a/uwBridge/apps/client/example!/filesystem/asset/models/feedback/page.html b/uwBridge/apps/client/example!/filesystem/asset/models/feedback/page.html index 3d711454..ec40e606 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/models/feedback/page.html +++ b/uwBridge/apps/client/example!/filesystem/asset/models/feedback/page.html @@ -34,7 +34,7 @@

- CODE: {{feedback.current.code}} + CODE: {{feedback.current.code}}

{{/}}

diff --git a/uwBridge/apps/client/example!/filesystem/asset/models/login/page.html b/uwBridge/apps/client/example!/filesystem/asset/models/login/page.html index 00c66131..d8f910eb 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/models/login/page.html +++ b/uwBridge/apps/client/example!/filesystem/asset/models/login/page.html @@ -43,7 +43,7 @@

Log in to your account

{{/with}}
- Don't have an account? Register here. + Don't have an account? Register here.
diff --git a/uwBridge/apps/client/example!/filesystem/asset/models/nft/list.html b/uwBridge/apps/client/example!/filesystem/asset/models/nft/list.html index dad6472f..06c7f7fe 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/models/nft/list.html +++ b/uwBridge/apps/client/example!/filesystem/asset/models/nft/list.html @@ -34,7 +34,7 @@ {{#code.feed}} -
@@ -49,7 +49,7 @@
- +
@@ -65,7 +65,7 @@
- +
diff --git a/uwBridge/apps/client/example!/filesystem/asset/models/organization/list.html b/uwBridge/apps/client/example!/filesystem/asset/models/organization/list.html index 6f3f796a..94d56783 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/models/organization/list.html +++ b/uwBridge/apps/client/example!/filesystem/asset/models/organization/list.html @@ -34,7 +34,7 @@ {{#batch.feed}} -
@@ -49,7 +49,7 @@
- +
@@ -65,7 +65,7 @@
- +
diff --git a/uwBridge/apps/client/example!/filesystem/asset/models/product/list.html b/uwBridge/apps/client/example!/filesystem/asset/models/product/list.html index 6c9c3caf..d95dee6d 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/models/product/list.html +++ b/uwBridge/apps/client/example!/filesystem/asset/models/product/list.html @@ -36,7 +36,7 @@ {{#product.feed}} -
@@ -51,7 +51,7 @@
{{this.codeCount || 0}}
-
+
@@ -72,7 +72,7 @@
- +
diff --git a/uwBridge/apps/client/example!/filesystem/asset/models/product/page.html b/uwBridge/apps/client/example!/filesystem/asset/models/product/page.html index ee01303b..e2c8c0ec 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/models/product/page.html +++ b/uwBridge/apps/client/example!/filesystem/asset/models/product/page.html @@ -19,13 +19,13 @@ {{/}}

{{product.current.name}}

- + SCANS: {{product.current.scanCount}} - + FEEDBACK: {{product.current.feedbackCount}} - + BATCHES: {{product.current.batchCount}}
@@ -65,7 +65,7 @@
Product Questions
{{/}}

- + {{product.current.facilityData.name}} @@ -108,7 +108,7 @@

Facility Questions
{{/}}

- + {{product.current.organizationData.name}} diff --git a/uwBridge/apps/client/example!/filesystem/asset/models/signup/page.html b/uwBridge/apps/client/example!/filesystem/asset/models/signup/page.html index 2844bee3..d4ce2586 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/models/signup/page.html +++ b/uwBridge/apps/client/example!/filesystem/asset/models/signup/page.html @@ -50,7 +50,7 @@

Create an account

{{/with}}
- Already have an account? Login here. + Already have an account? Login here.
diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/batch/admin/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/batch/admin/index.js index ced9f323..5a003d08 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/batch/admin/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/batch/admin/index.js @@ -8,7 +8,6 @@ } = app; const dirname = exports.dirname; await component({ - model: exports, asset: { template: `${dirname}template`, css: [`${dirname}style`], @@ -251,5 +250,4 @@ }); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/batch/admin/template.html b/uwBridge/apps/client/example!/filesystem/asset/routes/batch/admin/template.html index 59cf0a9c..24733678 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/batch/admin/template.html +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/batch/admin/template.html @@ -24,18 +24,18 @@

Batch ID
{{item.data._id}}
Batch Creator
-
{{item.data.creatorName}}
+
{{item.data.creatorName}}
Product Name
-
{{item.data.productName}}
+
{{item.data.productName}}
Product Description
{{item.data.productDescription}}
Organization
-
{{item.data.organizationName || 'View'}} - {{item.data.organizationContact}}
+
{{item.data.organizationName || 'View'}} - {{item.data.organizationContact}}
Organization Owner
-
{{item.data.organizationOwnerName}}
+
{{item.data.organizationOwnerName}}
{{#item.data.facility}}
Facility
-
{{item.data.facilityName}}
+
{{item.data.facilityName}}
Facility Contact
{{item.data.facilityContact}}
{{/}} @@ -52,7 +52,7 @@

{{/}} {{#item.id === 'code' && item.opened}} {{#list}} -
  • {{this._id}}
  • +
  • {{this._id}}
  • {{/}} {{/}} {{#item.id === 'label' && item.opened}} diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/batch/operator/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/batch/operator/index.js index d71675c9..60a3863b 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/batch/operator/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/batch/operator/index.js @@ -6,7 +6,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { batchEditModal: `models/batch/modal/edit`, @@ -34,5 +33,4 @@ }); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/batch/owner/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/batch/owner/index.js index d71675c9..60a3863b 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/batch/owner/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/batch/owner/index.js @@ -6,7 +6,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { batchEditModal: `models/batch/modal/edit`, @@ -34,5 +33,4 @@ }); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/batches/operator/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/batches/operator/index.js index a980baf3..2d464e45 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/batches/operator/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/batches/operator/index.js @@ -7,7 +7,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { batch: `models/batch/list`, @@ -53,5 +52,4 @@ await productEvents.loadPage(); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/batches/owner/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/batches/owner/index.js index a980baf3..2d464e45 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/batches/owner/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/batches/owner/index.js @@ -7,7 +7,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { batch: `models/batch/list`, @@ -53,5 +52,4 @@ await productEvents.loadPage(); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/campaign/admin/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/campaign/admin/index.js index adf3e035..31916ae6 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/campaign/admin/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/campaign/admin/index.js @@ -6,7 +6,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { campaignEditModal: `models/campaign/modal/edit`, @@ -34,5 +33,4 @@ }); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/campaign/operator/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/campaign/operator/index.js index a2796f6d..8bb63c5f 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/campaign/operator/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/campaign/operator/index.js @@ -6,7 +6,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { campaignEditModal: `models/campaign/modal/edit`, @@ -34,5 +33,4 @@ }); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/campaign/owner/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/campaign/owner/index.js index adf3e035..31916ae6 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/campaign/owner/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/campaign/owner/index.js @@ -6,7 +6,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { campaignEditModal: `models/campaign/modal/edit`, @@ -34,5 +33,4 @@ }); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/campaigns/admin/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/campaigns/admin/index.js index e73f9258..e4fffc13 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/campaigns/admin/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/campaigns/admin/index.js @@ -3,7 +3,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { campaign: `models/campaign/list`, @@ -38,5 +37,4 @@ source.on('*.campaign.edited', campaignEvents.loadPage); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/campaigns/operator/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/campaigns/operator/index.js index f44d191c..c61d9738 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/campaigns/operator/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/campaigns/operator/index.js @@ -2,9 +2,7 @@ const { component, } = app; app.debug = true; import { eventsCompile } from 'models/universal/index.js'; - await component({ - model: exports, asset: { partials: { campaign: `models/campaign/list`, @@ -38,5 +36,4 @@ await campaignEvents.loadMain(true); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/campaigns/owner/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/campaigns/owner/index.js index a8172075..c61d9738 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/campaigns/owner/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/campaigns/owner/index.js @@ -3,7 +3,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { campaign: `models/campaign/list`, @@ -37,5 +36,4 @@ await campaignEvents.loadMain(true); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/code/admin/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/code/admin/index.js index 219fa146..9db771bf 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/code/admin/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/code/admin/index.js @@ -6,7 +6,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { codeEditModal: `models/code/modal/edit`, @@ -31,5 +30,4 @@ source.on('*.code.edited', codeEvents.loadPage); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/code/operator/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/code/operator/index.js index 219fa146..9db771bf 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/code/operator/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/code/operator/index.js @@ -6,7 +6,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { codeEditModal: `models/code/modal/edit`, @@ -31,5 +30,4 @@ source.on('*.code.edited', codeEvents.loadPage); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/code/owner/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/code/owner/index.js index 219fa146..9db771bf 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/code/owner/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/code/owner/index.js @@ -6,7 +6,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { codeEditModal: `models/code/modal/edit`, @@ -31,5 +30,4 @@ source.on('*.code.edited', codeEvents.loadPage); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/codes/admin/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/codes/admin/index.js index 942913eb..50481451 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/codes/admin/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/codes/admin/index.js @@ -7,7 +7,6 @@ import { codeEventsCompile } from 'models/code/index.js'; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { code: `models/code/list`, @@ -50,5 +49,4 @@ }); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/codes/operator/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/codes/operator/index.js index 942913eb..50481451 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/codes/operator/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/codes/operator/index.js @@ -7,7 +7,6 @@ import { codeEventsCompile } from 'models/code/index.js'; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { code: `models/code/list`, @@ -50,5 +49,4 @@ }); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/codes/owner/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/codes/owner/index.js index 942913eb..50481451 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/codes/owner/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/codes/owner/index.js @@ -7,7 +7,6 @@ import { codeEventsCompile } from 'models/code/index.js'; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { code: `models/code/list`, @@ -50,5 +49,4 @@ }); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/dash/admin/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/dash/admin/index.js index c8af4e20..3ceaa7d9 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/dash/admin/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/dash/admin/index.js @@ -9,7 +9,6 @@ } = app; const dirname = exports.dirname; await component({ - model: exports, asset: { template: `${dirname}template`, css: [`${dirname}style`], diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/dash/admin/template.html b/uwBridge/apps/client/example!/filesystem/asset/routes/dash/admin/template.html index 55c1288d..0f8f542f 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/dash/admin/template.html +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/dash/admin/template.html @@ -52,7 +52,7 @@

    {{#each stats as item}} -
    diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/dash/open/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/dash/open/index.js index 3cc97b32..698d4f28 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/dash/open/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/dash/open/index.js @@ -7,7 +7,6 @@ } = app; app.debug = true; await component({ - model: exports, asset: { template: `models/login/page`, }, diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/dash/operator/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/dash/operator/index.js index 23b428bb..208a60cc 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/dash/operator/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/dash/operator/index.js @@ -6,7 +6,6 @@ } = app; const dirname = exports.dirname; await component({ - model: exports, asset: { template: `${dirname}template`, css: [`${dirname}style`], diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/dash/operator/template.html b/uwBridge/apps/client/example!/filesystem/asset/routes/dash/operator/template.html index e446a0c8..a4787171 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/dash/operator/template.html +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/dash/operator/template.html @@ -17,7 +17,7 @@

    {{#each stats.organization as item}} {{#if item.title && item.count}} -
    +
    {{count}}
    {{title}} @@ -29,7 +29,7 @@

    {{#each stats.facility as item}} {{#if item.title && item.count}} -
    +
    {{count}}
    {{title}} diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/dash/owner/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/dash/owner/index.js index 23b428bb..208a60cc 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/dash/owner/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/dash/owner/index.js @@ -6,7 +6,6 @@ } = app; const dirname = exports.dirname; await component({ - model: exports, asset: { template: `${dirname}template`, css: [`${dirname}style`], diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/dash/owner/template.html b/uwBridge/apps/client/example!/filesystem/asset/routes/dash/owner/template.html index e446a0c8..a4787171 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/dash/owner/template.html +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/dash/owner/template.html @@ -17,7 +17,7 @@

    {{#each stats.organization as item}} {{#if item.title && item.count}} -
    +
    {{count}}
    {{title}} @@ -29,7 +29,7 @@

    {{#each stats.facility as item}} {{#if item.title && item.count}} -
    +
    {{count}}
    {{title}} diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/dash/user/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/dash/user/index.js index 03657ffe..b3adc404 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/dash/user/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/dash/user/index.js @@ -5,7 +5,6 @@ } = app; const dirname = exports.dirname; await component({ - model: exports, asset: { template: `${dirname}template`, css: [`${dirname}style`], diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/dash/user/template.html b/uwBridge/apps/client/example!/filesystem/asset/routes/dash/user/template.html index ca48052a..5b4f89a0 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/dash/user/template.html +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/dash/user/template.html @@ -17,7 +17,7 @@

    {{#each stats as item}} {{#if item.title}} -
    +
    {{count}}
    {{title}} diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/facility/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/facility/index.js index c9ec2c3b..e6043fbb 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/facility/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/facility/index.js @@ -11,7 +11,6 @@ } = app; const dirname = exports.dirname; await component({ - model: exports, asset: { partials: { createModal: `${dirname}modalCreate`, diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/facility/template.html b/uwBridge/apps/client/example!/filesystem/asset/routes/facility/template.html index bbb4208c..0720189e 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/facility/template.html +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/facility/template.html @@ -30,7 +30,7 @@

    Tax ID
    {{item.data.tax}}
    Organization
    -
    {{item.data.organizationName || 'View'}} - {{item.data.organizationContact}}
    +
    {{item.data.organizationName || 'View'}} - {{item.data.organizationContact}}

    @@ -44,7 +44,7 @@

    {{/}} {{#item.id === 'product' && item.opened}} {{#list}} -
  • {{this.name}}
  • +
  • {{this.name}}
  • {{/}} {{/}} diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/batch/owner/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/batch/owner/index.js index f9d5d4cd..e3f4fa43 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/batch/owner/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/batch/owner/index.js @@ -5,7 +5,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { feedback: `models/feedback/list`, @@ -29,5 +28,4 @@ await feedbackEvents.loadMain(true); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/code/owner/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/code/owner/index.js index 697a024c..a87e8290 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/code/owner/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/code/owner/index.js @@ -5,7 +5,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { feedback: `models/feedback/list`, @@ -29,5 +28,4 @@ // await feedbackEvents.loadMain(true); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/operator/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/operator/index.js index 260ed3a9..46da58f1 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/operator/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/operator/index.js @@ -6,7 +6,6 @@ app.debug = true; import { feedbackEventsCompile } from 'models/feedback/index.js'; await component({ - model: exports, asset: { partials: { code: `models/feedback/list`, @@ -32,5 +31,4 @@ }); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/organization/owner/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/organization/owner/index.js index 3b94e6bf..53241037 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/organization/owner/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/organization/owner/index.js @@ -5,7 +5,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { feedback: `models/feedback/list`, @@ -29,5 +28,4 @@ await feedbackEvents.loadMain(true); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/owner/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/owner/index.js index 27428bcc..9200df59 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/owner/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/owner/index.js @@ -6,7 +6,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { feedback: `models/feedback/list`, @@ -30,5 +29,4 @@ await productEvents.loadMain(true); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/page/owner/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/page/owner/index.js index 33e6b34f..f849edd9 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/page/owner/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/page/owner/index.js @@ -6,7 +6,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { template: `models/feedback/page`, }, @@ -25,5 +24,4 @@ }); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/product/owner/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/product/owner/index.js index 4c38da84..fb531a00 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/product/owner/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/feedback/product/owner/index.js @@ -5,7 +5,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { feedback: `models/feedback/list`, @@ -29,5 +28,4 @@ await feedbackEvents.loadMain(true); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/login/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/login/index.js index 46a168f4..39cde31c 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/login/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/login/index.js @@ -6,7 +6,6 @@ } = app; app.debug = true; await component({ - model: exports, asset: { template: `models/login/page`, }, diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/nft/admin/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/nft/admin/index.js index 37525503..11eec246 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/nft/admin/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/nft/admin/index.js @@ -6,7 +6,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { feedbackCreateModal: `models/feedback/modal/create`, @@ -31,5 +30,4 @@ source.on('*.code.edited', codeEvents.loadPage); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/nft/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/nft/index.js index 37525503..11eec246 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/nft/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/nft/index.js @@ -6,7 +6,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { feedbackCreateModal: `models/feedback/modal/create`, @@ -31,5 +30,4 @@ source.on('*.code.edited', codeEvents.loadPage); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/nft/operator/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/nft/operator/index.js index 37525503..11eec246 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/nft/operator/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/nft/operator/index.js @@ -6,7 +6,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { feedbackCreateModal: `models/feedback/modal/create`, @@ -31,5 +30,4 @@ source.on('*.code.edited', codeEvents.loadPage); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/nft/owner/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/nft/owner/index.js index 37525503..11eec246 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/nft/owner/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/nft/owner/index.js @@ -6,7 +6,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { feedbackCreateModal: `models/feedback/modal/create`, @@ -31,5 +30,4 @@ source.on('*.code.edited', codeEvents.loadPage); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/nft/user/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/nft/user/index.js index 37525503..11eec246 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/nft/user/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/nft/user/index.js @@ -6,7 +6,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { feedbackCreateModal: `models/feedback/modal/create`, @@ -31,5 +30,4 @@ source.on('*.code.edited', codeEvents.loadPage); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/organization/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/organization/index.js index 89fdc407..1c4fb7a9 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/organization/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/organization/index.js @@ -11,7 +11,6 @@ } = app; const dirname = exports.dirname; await component({ - model: exports, asset: { partials: { createModal: `${dirname}modalCreate`, diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/organization/operator/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/organization/operator/index.js index cd29d1f5..0fe3ba0e 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/organization/operator/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/organization/operator/index.js @@ -5,9 +5,7 @@ } = app; app.debug = true; import { organizationEventsCompile } from 'models/organization/index.js'; - await component({ - model: exports, asset: { partials: { batchEditModal: `models/organization/modal/edit`, @@ -32,5 +30,4 @@ source.on('*.organization.edited', organizationEvents.loadPage); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/organization/owner/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/organization/owner/index.js index df33e23b..5c5491ec 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/organization/owner/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/organization/owner/index.js @@ -3,7 +3,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { organizationEditModal: `models/organization/modal/edit`, @@ -28,5 +27,4 @@ source.on('*.organization.edited', codeEvents.loadPage); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/organization/template.html b/uwBridge/apps/client/example!/filesystem/asset/routes/organization/template.html index e44801cc..e7490d0d 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/organization/template.html +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/organization/template.html @@ -52,17 +52,17 @@

    {{/}} {{#item.id === 'facility' && item.opened}} {{#list}} -
  • {{this.name}} - {{this.contact}}
  • +
  • {{this.name}} - {{this.contact}}
  • {{/}} {{/}} {{#item.id === 'product' && item.opened}} {{#list}} -
  • {{this.name}}
  • +
  • {{this.name}}
  • {{/}} {{/}} {{#item.id === 'user' && item.opened}} {{#list}} -
  • {{this.name}} - {{this.role}}
  • +
  • {{this.name}} - {{this.role}}
  • {{/}} {{/}} diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/organizations/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/organizations/index.js index fbc587dd..b32dcdb3 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/organizations/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/organizations/index.js @@ -11,7 +11,6 @@ } = app; const dirname = exports.dirname; await component({ - model: exports, asset: { partials: { createModal: `${dirname}modalCreate`, diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/organizations/template.html b/uwBridge/apps/client/example!/filesystem/asset/routes/organizations/template.html index 776d2301..e59e1ff2 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/organizations/template.html +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/organizations/template.html @@ -60,7 +60,7 @@

    {{#list}} - + {{name}} diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/product/admin/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/product/admin/index.js index 7f4e0953..bf506cb0 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/product/admin/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/product/admin/index.js @@ -12,7 +12,6 @@ } = app; const dirname = exports.dirname; await component({ - model: exports, asset: { template: `${dirname}template`, css: [`${dirname}style`], @@ -341,5 +340,4 @@ }); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/product/admin/template.html b/uwBridge/apps/client/example!/filesystem/asset/routes/product/admin/template.html index e883a63f..c23109a5 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/product/admin/template.html +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/product/admin/template.html @@ -23,10 +23,10 @@

    Description
    {{item.data.description}}
    Organization
    -
    {{item.data.organizationName || 'View'}} - {{item.data.organizationContact}}
    +
    {{item.data.organizationName || 'View'}} - {{item.data.organizationContact}}
    {{#item.data.facility}}
    Facility
    -
    {{item.data.facilityName || 'View'}} - {{item.data.facilityContact}}
    +
    {{item.data.facilityName || 'View'}} - {{item.data.facilityContact}}
    {{/}} {{#item.data.attachments}} Akerna Code @@ -47,7 +47,7 @@

    {{/}} {{#item.id === 'batch' && item.opened}} {{#list}} -
  • {{this.name}} ({{this.amount}})
  • +
  • {{this.name}} ({{this.amount}})
  • {{/}} {{/}} {{#item.id === 'label' && item.opened}} diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/product/operator/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/product/operator/index.js index 967c8796..01f7c5bf 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/product/operator/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/product/operator/index.js @@ -6,7 +6,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { productEditModal: `models/product/modal/edit`, @@ -39,5 +38,4 @@ }); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/product/owner/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/product/owner/index.js index 967c8796..01f7c5bf 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/product/owner/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/product/owner/index.js @@ -6,7 +6,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { productEditModal: `models/product/modal/edit`, @@ -39,5 +38,4 @@ }); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/products/operator/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/products/operator/index.js index 090a4a55..35c43fe1 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/products/operator/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/products/operator/index.js @@ -3,7 +3,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { product: `models/product/list`, @@ -39,5 +38,4 @@ await productEvents.loadMain(true); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/products/owner/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/products/owner/index.js index a03de73c..44bec40b 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/products/owner/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/products/owner/index.js @@ -6,7 +6,6 @@ app.debug = true; import { eventsCompile } from 'models/universal/index.js'; await component({ - model: exports, asset: { partials: { product: `models/product/list`, @@ -62,5 +61,4 @@ await productEvents.loadMain(true); }, }); - exports.compile = () => {}; })(); diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/qrcode/template.html b/uwBridge/apps/client/example!/filesystem/asset/routes/qrcode/template.html index 92289874..98916c37 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/qrcode/template.html +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/qrcode/template.html @@ -53,7 +53,7 @@

    SVG
    - - By checking this box you are agreeing to the Terms and Conditions. + - By checking this box you are agreeing to the Terms and Conditions.

    diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/settings/operator/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/settings/operator/index.js index 35359364..4e1b5d09 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/settings/operator/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/settings/operator/index.js @@ -8,7 +8,6 @@ } = app; const dirname = exports.dirname; await component({ - model: exports, asset: { template: `${dirname}template`, css: [`${dirname}style`], diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/settings/operator/template.html b/uwBridge/apps/client/example!/filesystem/asset/routes/settings/operator/template.html index f37ba0f3..84bdc3fd 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/settings/operator/template.html +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/settings/operator/template.html @@ -23,7 +23,7 @@

    {{role}}
    {{#Organization}}
    Organization
    -
    {{organizationName || 'View'}}
    +
    {{organizationName || 'View'}}
    {{/}}

    diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/signup/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/signup/index.js index 6d5b6edd..f6886650 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/signup/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/signup/index.js @@ -7,7 +7,6 @@ } = app; app.debug = true; await component({ - model: exports, asset: { template: `models/signup/page`, }, diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/user/index.js b/uwBridge/apps/client/example!/filesystem/asset/routes/user/index.js index 43e1472e..ade6f057 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/user/index.js +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/user/index.js @@ -8,7 +8,6 @@ } = app; const dirname = exports.dirname; await component({ - model: exports, asset: { template: `${dirname}template`, css: [`${dirname}style`], diff --git a/uwBridge/apps/client/example!/filesystem/asset/routes/user/template.html b/uwBridge/apps/client/example!/filesystem/asset/routes/user/template.html index e34dc496..aed75063 100644 --- a/uwBridge/apps/client/example!/filesystem/asset/routes/user/template.html +++ b/uwBridge/apps/client/example!/filesystem/asset/routes/user/template.html @@ -22,7 +22,7 @@

    {{role}}
    {{#Organization}}
    Organization
    -
    {{organizationName || 'View'}}
    +
    {{organizationName || 'View'}}
    {{/}}

    diff --git a/uwBridge/apps/client/example!/filesystem/public/Sentivate.js b/uwBridge/apps/client/example!/filesystem/public/Sentivate.js index aee2612f..33a4616d 100644 --- a/uwBridge/apps/client/example!/filesystem/public/Sentivate.js +++ b/uwBridge/apps/client/example!/filesystem/public/Sentivate.js @@ -17,6 +17,17 @@ start(data) { return app.workerRequest('configure', data); }, + log(...args) { + if (app.debug) { + apply(console.log, console, args); + } + }, + security: { + clear() { + app.log('Cleanup'); + app.crate.clear(); + } + }, utility: window.$ }; window.app = app; @@ -77,7 +88,7 @@ }; app.isEventNode = isEventNodeMethod; const { - last: last$1, first + last: last$2, first } = app.utility; const isLang = new RegExp(/^language\//); const languagePath = (filePath) => { @@ -88,7 +99,7 @@ } filePathCompiled = `language${filePathCompiled}`; } - if (last$1(filePathCompiled) !== '/') { + if (last$2(filePathCompiled) !== '/') { filePathCompiled = `${filePathCompiled}/`; } return `${filePathCompiled}${app.systemLanguage}.json`; @@ -96,7 +107,7 @@ app.languagePath = languagePath; const { utility: { - hasValue: hasValue$2, promise: promise$1, uid, isString: isString$3 + hasValue: hasValue$4, promise: promise$1, uid, isString: isString$7 } } = app; const mainWorker = new Worker('/worker.js'); @@ -137,14 +148,14 @@ id, data } = eventData; let generatedId = id; - if (!hasValue$2(generatedId)) { + if (!hasValue$4(generatedId)) { generatedId = '_'; } if (!app.events[generatedId]) { console.log(id, generatedId); } app.events[generatedId](data); - if (!eventData.keep && !isString$3(generatedId)) { + if (!eventData.keep && !isString$7(generatedId)) { app.events[generatedId] = null; uid.free(generatedId); } @@ -154,13 +165,13 @@ }; app.workerRequest = workerRequest; const { - assign: assign$3, querySelector, map: map$1, hasValue: hasValue$1, isString: isString$2 + assign: assign$9, querySelector: querySelector$2, map: map$2, hasValue: hasValue$3, isString: isString$6 } = app.utility; const { - crate: crate$1 + crate: crate$2 } = app; const imported = {}; - const headNode = querySelector('head'); + const headNode$1 = querySelector$2('head'); const styleNode = document.createElement('style'); const loadScript = window.eval; const iJson = (contents) => { @@ -171,13 +182,13 @@ }; const isLibRegex = new RegExp(/^js\/lib\//); const checksumReturn = (item) => { - return crate$1.getItem(`cs-${item}`); + return crate$2.getItem(`cs-${item}`); }; const constructStyleTagThenAppendToHead = (text, filePath) => { const node = styleNode.cloneNode(false); node.textContent = text; node.setAttribute('data-src', filePath); - headNode.appendChild(node); + headNode$1.appendChild(node); return node; }; /* @@ -190,7 +201,7 @@ const { callback, data } = config; - const assetCollection = map$1(data, getLoadedAssets); + const assetCollection = map$2(data, getLoadedAssets); callback(...assetCollection); }; const checkIfCompleted = (config) => { @@ -211,16 +222,16 @@ let skipCheck; if (fileContents === true) { if (!imported[filename]) { - fileContents = crate$1.getItem(filename); + fileContents = crate$2.getItem(filename); } } else if (fileContents !== false) { if (app.debug) { console.log('SAVE FILE TO LOCAL', fileContents); } - crate$1.setItem(`cs-${filename}`, cs); - crate$1.setItem(filename, fileContents); + crate$2.setItem(`cs-${filename}`, cs); + crate$2.setItem(filename, fileContents); } - if (!hasValue$1(imported[filename]) || fileContents !== true) { + if (!hasValue$3(imported[filename]) || fileContents !== true) { if (!isJs) { if (fileContents === false) { imported[filename] = {}; @@ -248,7 +259,7 @@ } } } - if (isCss && appendCSS && isString$2(imported[filename])) { + if (isCss && appendCSS && isString$6(imported[filename])) { constructStyleTagThenAppendToHead(imported[filename], filename); imported[filename] = true; } @@ -263,30 +274,26 @@ config.fileCount = config.data.length; await workerRequest({ async callback(json) { - if (hasValue$1(json.file)) { - try { - await saveCompleted(json, config); - } catch (err) { - console.log(config, json.file); - } + if (hasValue$3(json.file)) { + await saveCompleted(json, config); } else { return checkIfCompleted(config); } }, data: { data: { - cs: map$1(configData, checksumReturn), + cs: map$2(configData, checksumReturn), files: configData } }, request: 'socket.get' }); }; - assign$3(app, { + assign$9(app, { fetchFile }); const { - assign: assign$2 + assign: assign$8 } = app.utility; const request = async (requestName, config) => { const requestPackage = config ? @@ -309,43 +316,43 @@ const json = await workerRequest(workerPackage); return json; }; - assign$2(app, { + assign$8(app, { request }); const { utility: { - assign: assign$1, - cnsl: cnsl$1, + assign: assign$7, + cnsl: cnsl$3, compactMapArray, - isEmpty, + isEmpty: isEmpty$1, eachAsync, eachObject, eachArray, - isString: isString$1, - isPlainObject: isPlainObject$1, - hasValue, + isString: isString$5, + isPlainObject: isPlainObject$2, + hasValue: hasValue$2, drop } } = app; - cnsl$1('Initilizing watchers module.', 'notify'); + cnsl$3('Initilizing watchers module.', 'notify'); const watchers = {}; const watchersRegex = []; const onRegex = (type, callable) => { const watchObject = {}; callable.regex = type; let number = watchersRegex.push(callable) - 1; - assign$1(watchObject, { + assign$7(watchObject, { _: { isWatcher: true }, callable, start() { - if (!hasValue(number)) { + if (!hasValue$2(number)) { number = watchersRegex.push(callable) - 1; } }, stop() { - if (hasValue(number)) { + if (hasValue$2(number)) { drop(watchersRegex, number); number = null; } @@ -360,18 +367,18 @@ } const levelObject = watchers[type]; let number = levelObject.push(callable) - 1; - assign$1(watchObject, { + assign$7(watchObject, { _: { isWatcher: true }, callable, start() { - if (!hasValue(number)) { + if (!hasValue$2(number)) { number = levelObject.push(callable) - 1; } }, stop() { - if (hasValue(number)) { + if (hasValue$2(number)) { drop(levelObject, number); number = null; } @@ -404,26 +411,26 @@ }); return watchCollection; }; - const watch = (type, callable) => { + const watch$3 = (type, callable) => { let method; - if (isString$1(type)) { + if (isString$5(type)) { method = onString; - } else if (isPlainObject$1(type)) { + } else if (isPlainObject$2(type)) { method = onCollection; } else { method = onRegex; } return method(type, callable); }; - watch.status = true; - watch.start = () => { - watch.status = true; + watch$3.status = true; + watch$3.start = () => { + watch$3.status = true; }; - watch.stop = () => { - watch.status = null; + watch$3.stop = () => { + watch$3.status = null; }; const onUpdate = async (json) => { - if (!watch.status || !json) { + if (!watch$3.status || !json) { return; } const type = json.type; @@ -434,7 +441,7 @@ return item; } }); - if (!isEmpty(regexSubscribers)) { + if (!isEmpty$1(regexSubscribers)) { subscribers.push(...regexSubscribers); } if (levelObject) { @@ -454,21 +461,31 @@ request: requestName }); }; - assign$1(app.events, { + assign$7(app.events, { _(json) { return onUpdate(json.data); } }); - assign$1(app, { + assign$7(app, { push, - watch, + watch: watch$3, watchers }); const { utility: { - assign, hasDot, promise, last, map, isString, isPlainObject, each, cnsl, initialString, restString + assign: assign$6, + hasDot, + promise, + last: last$1, + map: map$1, + isString: isString$4, + isPlainObject: isPlainObject$1, + each: each$9, + cnsl: cnsl$2, + initialString, + restString }, - crate + crate: crate$1 } = app; const commaString = ','; const buildFilePath = (itemArg) => { @@ -476,7 +493,7 @@ if (!hasDot(item)) { if (initialString(item, -9) === 'language/') { item = languagePath(item); - } else if (last(item) === '/') { + } else if (last$1(item) === '/') { item += 'index.js'; } else if (initialString(item, -3) === 'js/') { item += '.js'; @@ -489,15 +506,15 @@ } if (restString(item, -3) === '.js') { if (app.debug) { - console.log(item, watch); + console.log(item, watch$3); } if (!watchers[item]) { - watch(item, (thing) => { + watch$3(item, (thing) => { if (app.debug) { console.log('Live Reload', thing); } - crate.removeItem(thing.name); - crate.removeItem(`cs-${thing.name}`); + crate$1.removeItem(thing.name); + crate$1.removeItem(`cs-${thing.name}`); }); } } @@ -507,7 +524,7 @@ return items[0]; }; const objectDemand = (items, arrayToObjectMap) => { - return map(arrayToObjectMap, (item) => { + return map$1(arrayToObjectMap, (item) => { return items[item]; }); }; @@ -517,7 +534,7 @@ const streamAssets = (data, options) => { return promise((accept) => { fetchFile( - assign( + assign$6( { callback(...args) { accept(args); @@ -529,24 +546,24 @@ ); }); }; - const demand = async (filesArg, options) => { + const demand$4 = async (filesArg, options) => { const assets = []; let demandType; let arrayToObjectMap; let files = filesArg; - if (isPlainObject(files)) { + if (isPlainObject$1(files)) { demandType = objectDemand; arrayToObjectMap = {}; let index = 0; - each(files, (item, key) => { + each$9(files, (item, key) => { arrayToObjectMap[key] = index; index++; assets.push(buildFilePath(item)); }); } else { - files = isString(files) ? files.split(commaString) : files; + files = isString$4(files) ? files.split(commaString) : files; demandType = files.length < 2 ? singleDemand : multiDemand; - each(files, (item) => { + each$9(files, (item) => { assets.push(buildFilePath(item)); }); } @@ -556,54 +573,1029 @@ const demandTypeMethod = (type, optionsFunction) => { return function(filesArg, options) { let files = filesArg; - if (isString(files)) { + if (isString$4(files)) { files = files.split(commaString); } if (optionsFunction) { optionsFunction(options); } - files = map(files, (itemArg) => { + files = map$1(files, (itemArg) => { let item = itemArg; - if (type === 'js' && last(item) === '/') { + if (type === 'js' && last$1(item) === '/') { item += 'index'; } return `${item}.${type}`; }); - return demand(files, options); + return demand$4(files, options); }; }; - const demandCss = demandTypeMethod('css', (appendCSS) => { + const demandCss$1 = demandTypeMethod('css', (appendCSS) => { return { appendCSS }; }); - const demandJs = demandTypeMethod('js'); - const demandHtml = demandTypeMethod('html'); + const demandJs$1 = demandTypeMethod('js'); + const demandHtml$1 = demandTypeMethod('html'); const demandLang = (fileList) => { - const files = isString(fileList) ? fileList.split(commaString) : fileList; - return demand(map(files, languagePath)); + const files = isString$4(fileList) ? fileList.split(commaString) : fileList; + return demand$4(map$1(files, languagePath)); }; - assign(app.events, { + assign$6(app.events, { async setupCompleted(data) { - cnsl('Worker is Ready', 'notify'); + cnsl$2('Worker is Ready', 'notify'); app.systemLanguage = data.language; try { - await demand('Sentivate/'); - app.translate = await demand('language/global'); - await demand('app/'); + await demand$4('app/'); } catch (error) { console.log(error); - crate.clear(); + crate$1.clear(); window.location.reload(); } } }); - assign(app, { - demand, + assign$6(app, { + demand: demand$4, + demandCss: demandCss$1, + demandHtml: demandHtml$1, + demandJs: demandJs$1, + demandLang + }); + const spawnNotification = (data) => {}; + app.notify = async (data) => { + if (Notification.permission === 'granted') { + return spawnNotification(); + } else if (Notification.permission !== 'denied') { + await Notification.requestPermission(); + } + }; + const { + utility: { + debounce, eventAdd: eventAdd$1, isAgent, info, model, assign: assign$5 + } + } = app; + app.updateResize = async () => { + await Ractive.sharedSet(info); + const width = info.windowWidth; + let widthLevel = 0; + let screenSize; + if (width < 640) { + screenSize = 'miniScreen'; + } else if (width < 740) { + screenSize = 'tinyScreen'; + widthLevel = 1; + } else if (width < 1024) { + screenSize = 'smallScreen'; + widthLevel = 2; + } else if (width < 1920) { + screenSize = 'mediumScreen'; + widthLevel = 3; + } else if (width < 3000) { + screenSize = 'hdScreen'; + widthLevel = 4; + } else if (width > 3000) { + screenSize = '4kScreen'; + widthLevel = 5; + } + console.log(screenSize); + await Ractive.sharedSet( + assign$5(Ractive.sharedGet(), { + tinyScreen: false, + smallScreen: false, + mediumScreen: false, + hdScreen: false, + '4kScreen': false + }) + ); + await Ractive.sharedSet('screenSize', screenSize); + await Ractive.sharedSet(screenSize, true); + await Ractive.sharedSet('widthLevel', widthLevel); + }; + const updateResize = debounce(app.updateResize, 250); + function calculateScreen() { + requestAnimationFrame(updateResize); + } + eventAdd$1( + window, + 'resize', + () => { + calculateScreen(); + }, + true + ); + const smoothScroll = (element, to, duration) => { + if (duration <= 0) { + return; + } + const difference = to - element.scrollTop; + const perTick = (difference / duration) * 10; + requestAnimationFrame(() => { + element.scrollTop = element.scrollTop + perTick; + if (element.scrollTop === to) { + return; + } + smoothScroll(element, to, duration - 10); + }); + }; + const mobileCheck = () => { + let check = false; + const a = navigator.userAgent || navigator.vendor || window.opera; + if ( + (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i).test( + a + ) || + (/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw(n|u)|c55\/|capi|ccwa|cdm|cell|chtm|cldc|cmd|co(mp|nd)|craw|da(it|ll|ng)|dbte|dcs|devi|dica|dmob|do(c|p)o|ds(12|d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(|_)|g1 u|g560|gene|gf5|gmo|go(\.w|od)|gr(ad|un)|haie|hcit|hd(m|p|t)|hei|hi(pt|ta)|hp( i|ip)|hsc|ht(c(| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i(20|go|ma)|i230|iac( ||\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|[a-w])|libw|lynx|m1w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|mcr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|([1-8]|c))|phil|pire|pl(ay|uc)|pn2|po(ck|rt|se)|prox|psio|ptg|qaa|qc(07|12|21|32|60|[2-7]|i)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h|oo|p)|sdk\/|se(c(|0|1)|47|mc|nd|ri)|sgh|shar|sie(|m)|sk0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h|v|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl|tdg|tel(i|m)|tim|tmo|to(pl|sh)|ts(70|m|m3|m5)|tx9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas|your|zeto|zte/i).test( + a.substr(0, 4) + ) + ) { + check = true; + } + return check; + }; + const tabletCheck = () => { + return (/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/).test( + navigator.userAgent.toLowerCase() + ); + }; + app.initializeScreen = async () => { + const isMobile = mobileCheck(); + const isTablet = tabletCheck(); + if (isMobile) { + await Ractive.sharedSet('classes.mobile', true); + await Ractive.sharedSet('mobile', true); + } + if (isTablet) { + await Ractive.sharedSet('classes.tablet', true); + await Ractive.sharedSet('tablet', true); + } + if (!isMobile && !isTablet) { + await Ractive.sharedSet('classes.desktop', true); + await Ractive.sharedSet('desktop', true); + } + await Ractive.sharedSet('classes.chrome', isAgent.chrome); + await Ractive.sharedSet('classes.android', isAgent.android); + await Ractive.sharedSet('classes.linux', isAgent.linux); + await Ractive.sharedSet('classes.mozilla', isAgent.mozilla); + await Ractive.sharedSet('classes.applewebkit', isAgent.applewebkit); + await app.updateResize(); + }; + model('smoothScroll', smoothScroll); + window.Ractive.prototype.data = { + $: app.utility, + getComponent(partialName) { + const componentName = partialName; + const partial = `<${partialName} />`; + console.log(componentName); + const partialsCheck = Boolean(this.partials[partialName]); + if (!partialsCheck) { + this.partials[partialName] = partial; + } + return partialName; + }, + makePartial(id, template) { + const key = `partial-${id}`; + const partialsCheck = Boolean(this.partials[id]); + if (partialsCheck) { + return key; + } + this.partials[key] = template; + return key; + } + }; + const { + utility: { + findIndex, + hasValue: hasValue$1, + get: get$1, + isPlainObject, + findItem, + assignDeep: assignDeep$1, + ensureArray: ensureArray$1, + assign: assign$4, + each: each$8, + isArray: isArray$1, + isEmpty, + sortNewest, + sortOldest, + clear + } + } = app; + const extendRactive = { + async afterIndex(path, indexMatch, item, indexName) { + const index = findIndex(this.get(path), indexMatch, indexName); + if (hasValue$1(index)) { + await this.splice(path, index + 1, 0, ...ensureArray$1(item)); + } else { + await this.push(path, item); + } + }, + async assign(path, mergeObject) { + const item = this.get(path); + if (hasValue$1(item)) { + assignDeep$1(item, mergeObject); + await this.update(path); + return item; + } + }, + async beforeIndex(path, indexMatch, item, indexName) { + const index = findIndex(this.get(path), indexMatch, indexName); + if (hasValue$1(index)) { + await this.splice(path, index - 1, 0, ...ensureArray$1(item)); + } else { + await this.push(path, item); + } + }, + async clearArray(path) { + const arrayToClear = this.get(path); + if (arrayToClear) { + clear(arrayToClear); + await this.update(path); + } + }, + findItem(path, indexMatch, indexName) { + const item = find(this.get(path), indexMatch, indexName); + if (hasValue$1(item)) { + return item; + } + }, + getIndex(path, indexMatch, indexName) { + const index = findIndex(this.get(path), indexMatch, indexName); + if (hasValue$1(index)) { + return index; + } + }, + async mergeItem(path, indexMatch, newVal, indexName) { + const item = findItem(this.get(path), indexMatch, indexName); + if (hasValue$1(item)) { + assignDeep$1(item, newVal); + await this.update(path); + return item; + } + }, + async removeIndex(path, indexMatch, indexName) { + const index = findIndex(this.get(path), indexMatch, indexName); + if (hasValue$1(index)) { + await this.splice(path, index, 1); + } + }, + async setIndex(path, indexMatch, item, indexName, optionsArg) { + const options = optionsArg || {}; + const index = findIndex(this.get(path), indexMatch, indexName); + if (hasValue$1(index)) { + const pathSuffix = options.pathSuffix ? `.${options.pathSuffix}` : ''; + await this.set(`${path}.${index}${pathSuffix}`, item); + } else if (get$1('conflict', options) === 'insert') { + await this[get$1('conflictMethod', options) || 'push'](path, item); + } + }, + async sortNewest(path, property) { + const array = this.get(path); + sortNewest(array, property, true); + await this.update(path); + }, + async sortOldest(path, property) { + const array = this.get(path); + sortOldest(array, property, true); + await this.update(path); + }, + async syncCollection(path, newValArg, type = 'push', indexName = 'id') { + const oldVal = this.get(path); + if (isPlainObject(oldVal)) { + assignDeep$1(oldVal, newValArg); + } else { + const newVal = ensureArray$1(newValArg); + each$8(newVal, (item) => { + const oldValItem = findItem(oldVal, item[indexName], indexName); + if (hasValue$1(oldValItem)) { + assign$4(oldValItem, item); + } else { + oldVal[type](item); + } + }); + } + await this.update(path); + }, + async toggleIndex(path, indexMatchArg, pathSuffixArg, indexName) { + let indexMatch; + const arrayCheck = isArray$1(indexMatchArg); + if (arrayCheck && !isEmpty(indexMatchArg)) { + indexMatch = indexMatchArg.shift(); + } else { + indexMatch = indexMatchArg; + } + const index = findIndex(this.get(path), indexMatch, indexName); + if (hasValue$1(index)) { + const pathSuffix = pathSuffixArg ? `.${pathSuffixArg}` : ''; + await this.toggle(`${path}.${index}${pathSuffix}`); + } + if (arrayCheck && !isEmpty(indexMatchArg)) { + await this.toggleIndex(path, indexMatchArg, pathSuffixArg, indexName); + } + }, + async updateItem(path, indexMatch, react, indexName) { + const item = findItem(this.get(path), indexMatch, indexName); + if (hasValue$1(item)) { + react(item); + await this.update(path); + return item; + } + } + }; + assign$4(Ractive.prototype, extendRactive); + const getComponentName = (componentModel, componentName) => { + return componentModel === app.router.currentStateObject ? 'navState' : componentName; + }; + const { + watch: watch$2, + demand: demand$3, + utility: { + each: each$7, isFunction: isFunction$1 + }, + crate + } = app; + const onHtml = async (matchFilename, componentName, json) => { + const type = json.type; + const filePath = json.name; + if (app.debug) { + console.log('WATCH HTML', matchFilename, json); + } + if (!filePath.includes(matchFilename)) { + return; + } + const html = await demand$3(filePath); + crate.setItem(filePath, html); + if (app.debug) { + console.log(type, filePath, html); + } + if (isFunction$1(componentName)) { + componentName(html); + } else { + each$7(app.view.findAllComponents(componentName), (item) => { + if (app.debug) { + console.log(item); + } + item.resetTemplate(html); + }); + } + window.UIkit.update(document.body, 'update'); + }; + const watchHtml = (matchFilename, componentName) => { + if (app.debug) { + console.log('WATCH HTML', matchFilename); + } + return watch$2(matchFilename, (json) => { + onHtml(matchFilename, componentName, json); + }); + }; + watch$2.html = watchHtml; + const { + utility: { + each: each$6 + } + } = app; + const importPartials = (componentName, componentModel, asset) => { + if (asset.partials) { + each$6(asset.partials, (item, key) => { + watchHtml(item.includes('.html') ? item : `${item}.html`, (html) => { + const realName = getComponentName(componentModel, componentName); + each$6(app.view.findAllComponents(realName), (subItem) => { + subItem.resetPartial(key, html); + }); + }); + }); + } + }; + const importTemplate = (componentName, componentModel, asset) => { + let template = asset.template; + if (!template.includes('.html') && !template.includes('.hbs') && !template.includes('.mustache')) { + template = asset.template = asset.template = `${template}.html`; + } + if (template) { + watchHtml(template, (html) => { + const realName = getComponentName(componentModel, componentName); + if (realName) { + const matchedComponent = app.view.findComponent(realName); + if (matchedComponent) { + matchedComponent.resetTemplate(html); + } + } + }); + } + }; + const { + utility: { + each: each$5, isString: isString$3, isArray, apply: apply$3 + } + } = app; + const logMulti = console; + function debugMultiEvent(...args) { + if (app.debug || app.debugMultiEvent) { + apply$3(logMulti.log, logMulti, args); + } + } + const multiEvent = (currentView, componentEvent, events, ...args) => { + debugMultiEvent(currentView, componentEvent, events); + debugMultiEvent(args); + if (componentEvent && events.length) { + const { + original + } = componentEvent; + original.preventDefault(); + original.stopPropagation(); + } + if (events) { + if (isString$3(events)) { + each$5(events.split(','), (subItem) => { + if (subItem) { + currentView.fire(subItem.trim(), componentEvent, ...args); + } + }); + } else if (isArray(events)) { + each$5(events, (item) => { + if (item) { + each$5(item.split(','), (subItem) => { + if (subItem) { + currentView.fire(subItem.trim(), componentEvent, ...args); + } + }); + } + }); + } + } + }; + const { + utility: { + each: each$4, assign: assign$3, querySelector: querySelector$1 + } + } = app; + const headNode = querySelector$1('head'); + const importedCssCount = {}; + const importedCss = {}; + const render = (code, filePath) => { + if (importedCss[filePath]) { + importedCssCount[filePath]++; + } else { + importedCssCount[filePath] = 0; + const node = document.createElement('style'); + node.innerHTML = code; + node.setAttribute('data-src', filePath); + headNode.appendChild(node); + importedCss[filePath] = node; + } + }; + const unrender = (code, filePath) => { + if (importedCss[filePath]) { + importedCssCount[filePath]--; + if (importedCssCount[filePath] < 0) { + importedCss[filePath].remove(); + importedCss[filePath] = null; + importedCssCount[filePath] = null; + } + } + }; + const cssRender = (css) => { + if (css) { + each$4(css, render); + } + }; + const cssUnrender = (css) => { + if (css) { + each$4(css, unrender); + } + }; + const componentsWithCss = {}; + const registerCssComponent = (css, componentConfig) => { + if (!css) { + return; + } + each$4(css, (item, key) => { + if (!componentsWithCss[key]) { + componentsWithCss[key] = []; + } + componentsWithCss[key].push(componentConfig); + }); + }; + assign$3(app, { + componentsWithCss, + importedCss, + importedCssCount + }); + const { + watch: watch$1, + utility: { + each: each$3, get, apply: apply$2 + } + } = app; + const createWatchers = (currentView, item, key) => { + if (get('isWatcher', item._)) { + currentView.watchers[key] = item; + return; + } + item.options = item.options || {}; + item.methods = item.methods || {}; + let { + prefix, suffix + } = item.options; + const { + methods + } = item; + const createMethod = methods.create || 'push'; + const readMethod = methods.read || 'push'; + prefix = prefix ? `${prefix}.` : ''; + suffix = suffix ? `.${suffix}` : ''; + item.prefix = prefix; + item.suffix = suffix; + currentView.watchers[key] = watch$1( + { + async create(json) { + await currentView.syncCollection(key, json.item, createMethod); + currentView.fire(`${prefix}create${suffix}`, json.item, json); + }, + async delete(json) { + await currentView.removeIndex(key, json.item.id); + currentView.fire(`${prefix}delete${suffix}`, json.item, json); + }, + async read(json) { + await currentView.syncCollection(key, json.items, readMethod); + currentView.fire(`${prefix}read${suffix}`, json.item, json); + }, + async update(json) { + await currentView.syncCollection(key, json.item, createMethod); + currentView.fire(`${prefix}update${suffix}`, json.item, json); + } + }, + item.options + ); + }; + const removeInstance = function(currentView, css) { + cssUnrender(css); + each$3(currentView.watchers, (item, key) => { + item.stop(); + item[key] = null; + }); + }; + const onrenderInstance = function(currentView, css) { + cssRender(css); + if (currentView.watchers) { + each$3(currentView.watchers, (item) => { + item.start(); + }); + } + }; + const buildComponentEvents = function(componentConfig) { + const { + css, watchers + } = componentConfig; + const thisComponent = this; + thisComponent.watchers = watchers ? watchers(thisComponent) : {}; + if (thisComponent.watchers) { + each$3(thisComponent.watchers, (item, key) => { + createWatchers(thisComponent, item, key); + }); + } + thisComponent.on({ + multi(cmpntEvent, ...args) { + if (app.debug) { + console.log(cmpntEvent, ...args); + } + return multiEvent(this, cmpntEvent, ...args); + }, + render() { + return onrenderInstance(this, css); + }, + teardown() { + return removeInstance(this, css); + } + }); + }; + const onConstruct = function(componentConfig) { + const sourceConstruct = componentConfig.onconstruct; + componentConfig.onconstruct = function(...args) { + apply$2(buildComponentEvents, this, [componentConfig, ...args]); + if (sourceConstruct) { + return apply$2(sourceConstruct, this, args); + } + }; + const sourceRender = componentConfig.onrender; + componentConfig.onrender = function(...args) { + if (sourceRender) { + return apply$2(sourceRender, this, args); + } + }; + }; + const { + utility: { + cnsl: cnsl$1, assign: assign$2 + } + } = app; + cnsl$1('viewSetup Module', 'notify'); + const initializeComponent = (componentConfig) => { + componentConfig.decorators = assign$2(componentConfig.decorators || {}, {}); + const { + css, model: componentModel, asset, name: componentName + } = componentConfig; + registerCssComponent(css, componentConfig); + if (asset && (componentName || componentModel)) { + importTemplate(componentName, componentModel, asset); + importPartials(componentName, componentModel, asset); + } + onConstruct(componentConfig); + }; + const { + utility: { + omit + } + } = app; + const buildComponent = (componentConfig) => { + initializeComponent(componentConfig); + const { + name: componentName, model + } = componentConfig; + const cmpntConfigClean = omit(componentConfig, ['css', 'asset']); + if (componentConfig.CSS) { + cmpntConfigClean.css = componentConfig.CSS; + } + const Component = Ractive.extend(cmpntConfigClean); + if (componentName) { + Ractive.components[componentName] = Component; + } + if (model) { + model.component = Component; + } + return Component; + }; + const { + demand: demand$2, demandCss, demandHtml, + utility: { + assign: assign$1, each: each$2, ensureArray, isString: isString$2 + } + } = app; + const asyncComponent = async function(componentConfig) { + const componentModel = componentConfig.model; + let asset = componentConfig.asset || {}; + if (isString$2(asset)) { + asset = { + css: [`${asset}style`], + template: `${asset}template` + }; + } + componentConfig.asset = asset; + componentConfig.css = componentConfig.css || {}; + componentConfig.partials = componentConfig.partials || {}; + if (asset) { + if (asset.template) { + componentConfig.template = await demandHtml(asset.template); + } + if (asset.demand) { + componentConfig.demand = await demand$2(asset.demand); + } + if (asset.partials) { + assign$1(componentConfig.partials, await demandHtml(asset.partials)); + } + if (asset.css) { + const assetCss = asset.css; + const loadCss = await demandCss(assetCss); + each$2(ensureArray(loadCss), (item, index) => { + let keyName = assetCss[index]; + if (!keyName.includes('.css')) { + keyName = `${keyName}.css`; + } + componentConfig.css[keyName] = item; + }); + } + } + const componentPromise = buildComponent(componentConfig); + if (componentModel) { + componentModel.component = componentPromise; + } + return componentPromise; + }; + const { + utility: { + isString: isString$1 + } + } = app; + const components = {}; + const generateComponent = (ComponentView, config) => { + return new ComponentView(config); + }; + const getComponent = (componentName, config) => { + const componentObject = components[componentName]; + return config ? generateComponent(componentObject, config) : componentObject; + }; + const component$1 = (componentName, componentConfigOption) => { + let method; + const componentConfig = componentConfigOption ? componentConfigOption : componentName; + if (isString$1(componentName)) { + componentConfig.name = componentName; + } + console.log(componentConfig); + if (componentConfig.asset) { + method = asyncComponent; + } else { + method = buildComponent; + } + return method(componentConfig); + }; + app.component = component$1; + app.getComponent = getComponent; + const { + demand: demand$1, + watch, + utility: { + each: each$1, querySelector, isDom + } + } = app; + const onCss = async (json) => { + const filePath = json.name; + const componentName = json.type; + const componentsUsingCss = componentsWithCss[filePath]; + console.log('CSS UPDATE', filePath, componentsUsingCss); + const node = importedCss[filePath] || importedCss[componentName] || querySelector(`[data-src="${filePath}"]`); + if (node || componentsUsingCss) { + const content = await demand$1(filePath); + if (isDom(node)) { + node.innerHTML = content; + } + if (componentsUsingCss) { + each$1(componentsUsingCss, (item) => { + console.log(item); + item.css[filePath] = content; + }); + } + } + }; + watch(/\.css/, onCss); + const { + demand, + utility: { + assign, each, isFunction + } + } = app; + const view = new Ractive({ + data() { + return { + notification: [], + screenSize: '' + }; + }, + template: `{{#@shared.components.main:key}}{{>getComponent(key)}}{{/}}` + }); + view.on({ + async '*.loadComponent'(componentEvent) { + const imported = await demand(componentEvent.get('demand')); + const afterDemand = componentEvent.get('afterDemand'); + if (afterDemand) { + const afterDemandEvents = afterDemand[componentEvent.original.type]; + each(afterDemandEvents, (item, key) => { + if (isFunction(item)) { + item(imported, item, key); + } else { + app.view.findComponent(key).fire(item); + } + }); + } + }, + '*.preventDefault'(context) { + const { + original + } = context; + original.preventDefault(); + original.stopPropagation(); + } + }); + app.importComponent = async (componentName, importURL, type = 'dynamic') => { + if (importURL) { + await demand(importURL); + } + await view.set(`@shared.components.${type}.${componentName}`, true); + await view.update('@shared.components.${type}'); + }; + app.title = new Ractive({ + target: 'head', + append: true, + data() { + return {}; + }, + template: `{{@shared.pageTitle}}` + }); + assign(app, { + async render() { + await Ractive.sharedSet('components', { + dynamic: {}, + layout: {}, + main: {} + }); + await app.initializeScreen(); + await view.render('body'); + }, + view + }); + localStorage.clear(); + const { demandJs, - demandLang + utility: { + cnsl, assignDeep, mapArray, map, isString, rest, camelCase, eventAdd, apply: apply$1, isRegExp, mapWhile, ifInvoke, hasValue, last + }, + component + } = app; + cnsl('ROUTER ONLINE', 'important'); + class Router { + constructor() { + return this; + } + debug = false; + hostname = location.hostname; + pathname = location.pathname; + navHistory = []; + historyIndex = 0; + routes = []; + methods = {}; + defaults = { + protected: false, + role: false + }; + state; + log(...args) { + if (this.debug || app.debug) { + apply$1(console.log, console, args); + } + } + popstate(popstateEvent) { + app.router.log('popstate', popstateEvent); + popstateEvent.preventDefault(); + app.router.process(); + } + pushState(url) { + history.pushState({}, url, url); + app.router.process(); + } + installRoute(routeModel) { + app.router.log('Install Route', routeModel); + const { + match + } = routeModel; + if (match) { + routeModel.regex = isRegExp(match) ? match : new RegExp(match); + } + return app.router.routes.push(routeModel); + } + add(item) { + this.log('add routes', item); + return mapArray(item, this.installRoute); + } + async setup(options) { + this.log('setup router'); + this.add(options.routes); + this.log('assign options'); + assignDeep(this, options); + this.log('eventAdd popstate'); + eventAdd(window, 'popstate', this.popstate, true); + await this.process(); + } + async updateLocation() { + map(location, (item, index) => { + if (isString(item)) { + this[index] = item; + } + }); + this.pathScored = this.pathname.replace(/\//g, '_'); + this.paths = rest(this.pathname.split('/')); + this.pathCamel = camelCase(this.paths.join('_')); + this.navHistory.push(this.pathname); + this.historyIndex++; + } + async compilePath() { + const { + route, secured, role, path + } = this.pathState; + this.log(this.pathState); + if (route) { + this.pathState.path = route(); + } else if (!path) { + this.pathState.path = this.pathname; + } + if (last(this.pathState.path) !== '/') { + this.pathState.path = `${this.pathState.path}/`; + } + if (this.pathState.path[0] !== '/') { + this.pathState.path = `/${this.pathState.path}`; + } + if (secured) { + const securityCheck = Boolean(await this.methods.security(this.match)); + if (securityCheck) { + const success = await this.methods.success(); + if (role) { + this.pathState.path = `${path}${success}/`; + } + } else { + this.pathState.path = `/${await this.methods.fail()}/`; + } + } + this.pathState.path = `/${this.defaults.root}${this.pathState.path}index`; + } + checkMatch(routeObject) { + const check = routeObject.regex.test(app.router.pathname); + if (check) { + app.router.routeState = routeObject; + } + app.router.log(check, app.router.pathname, routeObject.regex); + return !check; + } + async close() { + const currentComponent = this.component; + if (currentComponent) { + console.log('Close Component', this, currentComponent); + await app.view.findComponent('navstate').teardown(); + this.component = null; + } + } + async process() { + app.view.fire('router.loading'); + this.log('Router Loading State'); + this.updateLocation(); + this.log(this.routes); + mapWhile(this.routes, this.checkMatch); + const match = app.router.routeState; + this.log('Match found', match); + if (match) { + await this.close(); + const { + path, route + } = match; + const secured = hasValue(match.secured) ? match.secured : this.defaults.secured; + const role = hasValue(match.role) ? match.role : this.defaults.role; + const pathState = { + match, + secured, + role, + path, + route + }; + this.pathState = pathState; + this.match = match; + await this.compilePath(); + await Ractive.sharedSet('@shared.currentPath', this.pathname); + await Ractive.sharedSet('navState', false); + this.log('Checking if Model Loaded', match.model); + if (!match.model) { + if (match.assets) { + if (match.assets.scripts) { + await demandJs(match.assets.scripts); + } + } + this.log('match model', pathState.path); + match.model = await demandJs(pathState.path); + this.log(match.model); + } + this.state = match; + const initializeComponent = await component(match.model.component); + this.log('component made', initializeComponent); + Ractive.components.navstate = initializeComponent; + ifInvoke(match.model.open); + ifInvoke(this.methods.onLoad); + await Ractive.sharedSet('navState', true); + } else { + return false; + } + this.log('Finished processing'); + } + back() { + this.log('Router back State'); + const navHistory = this.navHistory; + if (navHistory.length) { + router.historyIndex--; + window.history.back(); + } + } + forward() { + this.log('Router forward State'); + const navHistory = this.navHistory; + if (navHistory.length > this.historyIndex) { + router.historyIndex++; + window.history.forward(); + } + } + } + app.router = new Router(); + app.view.on({ + '*.routerBack'() { + app.router.back(); + }, + '*.routerForward'() { + app.router.forward(); + }, + '*.route'(componentEvent) { + const { + original, node + } = componentEvent; + const url = componentEvent.get('href') || node.getAttribute('href') || node.getAttribute('data-href'); + original.preventDefault(); + app.router.log(componentEvent, url); + app.router.pushState(url); + return false; + } }); })(); diff --git a/uwBridge/system/compile/.vscode/settings.json b/uwBridge/system/compile/.vscode/settings.json index 065e2b8b..100bd6a1 100644 --- a/uwBridge/system/compile/.vscode/settings.json +++ b/uwBridge/system/compile/.vscode/settings.json @@ -12,6 +12,7 @@ "ccwa", "chtm", "cldc", + "cnsl", "dbte", "dica", "dmob", diff --git a/uwBridge/system/compile/build/front/bundle.js b/uwBridge/system/compile/build/front/bundle.js index aee2612f..33a4616d 100644 --- a/uwBridge/system/compile/build/front/bundle.js +++ b/uwBridge/system/compile/build/front/bundle.js @@ -17,6 +17,17 @@ start(data) { return app.workerRequest('configure', data); }, + log(...args) { + if (app.debug) { + apply(console.log, console, args); + } + }, + security: { + clear() { + app.log('Cleanup'); + app.crate.clear(); + } + }, utility: window.$ }; window.app = app; @@ -77,7 +88,7 @@ }; app.isEventNode = isEventNodeMethod; const { - last: last$1, first + last: last$2, first } = app.utility; const isLang = new RegExp(/^language\//); const languagePath = (filePath) => { @@ -88,7 +99,7 @@ } filePathCompiled = `language${filePathCompiled}`; } - if (last$1(filePathCompiled) !== '/') { + if (last$2(filePathCompiled) !== '/') { filePathCompiled = `${filePathCompiled}/`; } return `${filePathCompiled}${app.systemLanguage}.json`; @@ -96,7 +107,7 @@ app.languagePath = languagePath; const { utility: { - hasValue: hasValue$2, promise: promise$1, uid, isString: isString$3 + hasValue: hasValue$4, promise: promise$1, uid, isString: isString$7 } } = app; const mainWorker = new Worker('/worker.js'); @@ -137,14 +148,14 @@ id, data } = eventData; let generatedId = id; - if (!hasValue$2(generatedId)) { + if (!hasValue$4(generatedId)) { generatedId = '_'; } if (!app.events[generatedId]) { console.log(id, generatedId); } app.events[generatedId](data); - if (!eventData.keep && !isString$3(generatedId)) { + if (!eventData.keep && !isString$7(generatedId)) { app.events[generatedId] = null; uid.free(generatedId); } @@ -154,13 +165,13 @@ }; app.workerRequest = workerRequest; const { - assign: assign$3, querySelector, map: map$1, hasValue: hasValue$1, isString: isString$2 + assign: assign$9, querySelector: querySelector$2, map: map$2, hasValue: hasValue$3, isString: isString$6 } = app.utility; const { - crate: crate$1 + crate: crate$2 } = app; const imported = {}; - const headNode = querySelector('head'); + const headNode$1 = querySelector$2('head'); const styleNode = document.createElement('style'); const loadScript = window.eval; const iJson = (contents) => { @@ -171,13 +182,13 @@ }; const isLibRegex = new RegExp(/^js\/lib\//); const checksumReturn = (item) => { - return crate$1.getItem(`cs-${item}`); + return crate$2.getItem(`cs-${item}`); }; const constructStyleTagThenAppendToHead = (text, filePath) => { const node = styleNode.cloneNode(false); node.textContent = text; node.setAttribute('data-src', filePath); - headNode.appendChild(node); + headNode$1.appendChild(node); return node; }; /* @@ -190,7 +201,7 @@ const { callback, data } = config; - const assetCollection = map$1(data, getLoadedAssets); + const assetCollection = map$2(data, getLoadedAssets); callback(...assetCollection); }; const checkIfCompleted = (config) => { @@ -211,16 +222,16 @@ let skipCheck; if (fileContents === true) { if (!imported[filename]) { - fileContents = crate$1.getItem(filename); + fileContents = crate$2.getItem(filename); } } else if (fileContents !== false) { if (app.debug) { console.log('SAVE FILE TO LOCAL', fileContents); } - crate$1.setItem(`cs-${filename}`, cs); - crate$1.setItem(filename, fileContents); + crate$2.setItem(`cs-${filename}`, cs); + crate$2.setItem(filename, fileContents); } - if (!hasValue$1(imported[filename]) || fileContents !== true) { + if (!hasValue$3(imported[filename]) || fileContents !== true) { if (!isJs) { if (fileContents === false) { imported[filename] = {}; @@ -248,7 +259,7 @@ } } } - if (isCss && appendCSS && isString$2(imported[filename])) { + if (isCss && appendCSS && isString$6(imported[filename])) { constructStyleTagThenAppendToHead(imported[filename], filename); imported[filename] = true; } @@ -263,30 +274,26 @@ config.fileCount = config.data.length; await workerRequest({ async callback(json) { - if (hasValue$1(json.file)) { - try { - await saveCompleted(json, config); - } catch (err) { - console.log(config, json.file); - } + if (hasValue$3(json.file)) { + await saveCompleted(json, config); } else { return checkIfCompleted(config); } }, data: { data: { - cs: map$1(configData, checksumReturn), + cs: map$2(configData, checksumReturn), files: configData } }, request: 'socket.get' }); }; - assign$3(app, { + assign$9(app, { fetchFile }); const { - assign: assign$2 + assign: assign$8 } = app.utility; const request = async (requestName, config) => { const requestPackage = config ? @@ -309,43 +316,43 @@ const json = await workerRequest(workerPackage); return json; }; - assign$2(app, { + assign$8(app, { request }); const { utility: { - assign: assign$1, - cnsl: cnsl$1, + assign: assign$7, + cnsl: cnsl$3, compactMapArray, - isEmpty, + isEmpty: isEmpty$1, eachAsync, eachObject, eachArray, - isString: isString$1, - isPlainObject: isPlainObject$1, - hasValue, + isString: isString$5, + isPlainObject: isPlainObject$2, + hasValue: hasValue$2, drop } } = app; - cnsl$1('Initilizing watchers module.', 'notify'); + cnsl$3('Initilizing watchers module.', 'notify'); const watchers = {}; const watchersRegex = []; const onRegex = (type, callable) => { const watchObject = {}; callable.regex = type; let number = watchersRegex.push(callable) - 1; - assign$1(watchObject, { + assign$7(watchObject, { _: { isWatcher: true }, callable, start() { - if (!hasValue(number)) { + if (!hasValue$2(number)) { number = watchersRegex.push(callable) - 1; } }, stop() { - if (hasValue(number)) { + if (hasValue$2(number)) { drop(watchersRegex, number); number = null; } @@ -360,18 +367,18 @@ } const levelObject = watchers[type]; let number = levelObject.push(callable) - 1; - assign$1(watchObject, { + assign$7(watchObject, { _: { isWatcher: true }, callable, start() { - if (!hasValue(number)) { + if (!hasValue$2(number)) { number = levelObject.push(callable) - 1; } }, stop() { - if (hasValue(number)) { + if (hasValue$2(number)) { drop(levelObject, number); number = null; } @@ -404,26 +411,26 @@ }); return watchCollection; }; - const watch = (type, callable) => { + const watch$3 = (type, callable) => { let method; - if (isString$1(type)) { + if (isString$5(type)) { method = onString; - } else if (isPlainObject$1(type)) { + } else if (isPlainObject$2(type)) { method = onCollection; } else { method = onRegex; } return method(type, callable); }; - watch.status = true; - watch.start = () => { - watch.status = true; + watch$3.status = true; + watch$3.start = () => { + watch$3.status = true; }; - watch.stop = () => { - watch.status = null; + watch$3.stop = () => { + watch$3.status = null; }; const onUpdate = async (json) => { - if (!watch.status || !json) { + if (!watch$3.status || !json) { return; } const type = json.type; @@ -434,7 +441,7 @@ return item; } }); - if (!isEmpty(regexSubscribers)) { + if (!isEmpty$1(regexSubscribers)) { subscribers.push(...regexSubscribers); } if (levelObject) { @@ -454,21 +461,31 @@ request: requestName }); }; - assign$1(app.events, { + assign$7(app.events, { _(json) { return onUpdate(json.data); } }); - assign$1(app, { + assign$7(app, { push, - watch, + watch: watch$3, watchers }); const { utility: { - assign, hasDot, promise, last, map, isString, isPlainObject, each, cnsl, initialString, restString + assign: assign$6, + hasDot, + promise, + last: last$1, + map: map$1, + isString: isString$4, + isPlainObject: isPlainObject$1, + each: each$9, + cnsl: cnsl$2, + initialString, + restString }, - crate + crate: crate$1 } = app; const commaString = ','; const buildFilePath = (itemArg) => { @@ -476,7 +493,7 @@ if (!hasDot(item)) { if (initialString(item, -9) === 'language/') { item = languagePath(item); - } else if (last(item) === '/') { + } else if (last$1(item) === '/') { item += 'index.js'; } else if (initialString(item, -3) === 'js/') { item += '.js'; @@ -489,15 +506,15 @@ } if (restString(item, -3) === '.js') { if (app.debug) { - console.log(item, watch); + console.log(item, watch$3); } if (!watchers[item]) { - watch(item, (thing) => { + watch$3(item, (thing) => { if (app.debug) { console.log('Live Reload', thing); } - crate.removeItem(thing.name); - crate.removeItem(`cs-${thing.name}`); + crate$1.removeItem(thing.name); + crate$1.removeItem(`cs-${thing.name}`); }); } } @@ -507,7 +524,7 @@ return items[0]; }; const objectDemand = (items, arrayToObjectMap) => { - return map(arrayToObjectMap, (item) => { + return map$1(arrayToObjectMap, (item) => { return items[item]; }); }; @@ -517,7 +534,7 @@ const streamAssets = (data, options) => { return promise((accept) => { fetchFile( - assign( + assign$6( { callback(...args) { accept(args); @@ -529,24 +546,24 @@ ); }); }; - const demand = async (filesArg, options) => { + const demand$4 = async (filesArg, options) => { const assets = []; let demandType; let arrayToObjectMap; let files = filesArg; - if (isPlainObject(files)) { + if (isPlainObject$1(files)) { demandType = objectDemand; arrayToObjectMap = {}; let index = 0; - each(files, (item, key) => { + each$9(files, (item, key) => { arrayToObjectMap[key] = index; index++; assets.push(buildFilePath(item)); }); } else { - files = isString(files) ? files.split(commaString) : files; + files = isString$4(files) ? files.split(commaString) : files; demandType = files.length < 2 ? singleDemand : multiDemand; - each(files, (item) => { + each$9(files, (item) => { assets.push(buildFilePath(item)); }); } @@ -556,54 +573,1029 @@ const demandTypeMethod = (type, optionsFunction) => { return function(filesArg, options) { let files = filesArg; - if (isString(files)) { + if (isString$4(files)) { files = files.split(commaString); } if (optionsFunction) { optionsFunction(options); } - files = map(files, (itemArg) => { + files = map$1(files, (itemArg) => { let item = itemArg; - if (type === 'js' && last(item) === '/') { + if (type === 'js' && last$1(item) === '/') { item += 'index'; } return `${item}.${type}`; }); - return demand(files, options); + return demand$4(files, options); }; }; - const demandCss = demandTypeMethod('css', (appendCSS) => { + const demandCss$1 = demandTypeMethod('css', (appendCSS) => { return { appendCSS }; }); - const demandJs = demandTypeMethod('js'); - const demandHtml = demandTypeMethod('html'); + const demandJs$1 = demandTypeMethod('js'); + const demandHtml$1 = demandTypeMethod('html'); const demandLang = (fileList) => { - const files = isString(fileList) ? fileList.split(commaString) : fileList; - return demand(map(files, languagePath)); + const files = isString$4(fileList) ? fileList.split(commaString) : fileList; + return demand$4(map$1(files, languagePath)); }; - assign(app.events, { + assign$6(app.events, { async setupCompleted(data) { - cnsl('Worker is Ready', 'notify'); + cnsl$2('Worker is Ready', 'notify'); app.systemLanguage = data.language; try { - await demand('Sentivate/'); - app.translate = await demand('language/global'); - await demand('app/'); + await demand$4('app/'); } catch (error) { console.log(error); - crate.clear(); + crate$1.clear(); window.location.reload(); } } }); - assign(app, { - demand, + assign$6(app, { + demand: demand$4, + demandCss: demandCss$1, + demandHtml: demandHtml$1, + demandJs: demandJs$1, + demandLang + }); + const spawnNotification = (data) => {}; + app.notify = async (data) => { + if (Notification.permission === 'granted') { + return spawnNotification(); + } else if (Notification.permission !== 'denied') { + await Notification.requestPermission(); + } + }; + const { + utility: { + debounce, eventAdd: eventAdd$1, isAgent, info, model, assign: assign$5 + } + } = app; + app.updateResize = async () => { + await Ractive.sharedSet(info); + const width = info.windowWidth; + let widthLevel = 0; + let screenSize; + if (width < 640) { + screenSize = 'miniScreen'; + } else if (width < 740) { + screenSize = 'tinyScreen'; + widthLevel = 1; + } else if (width < 1024) { + screenSize = 'smallScreen'; + widthLevel = 2; + } else if (width < 1920) { + screenSize = 'mediumScreen'; + widthLevel = 3; + } else if (width < 3000) { + screenSize = 'hdScreen'; + widthLevel = 4; + } else if (width > 3000) { + screenSize = '4kScreen'; + widthLevel = 5; + } + console.log(screenSize); + await Ractive.sharedSet( + assign$5(Ractive.sharedGet(), { + tinyScreen: false, + smallScreen: false, + mediumScreen: false, + hdScreen: false, + '4kScreen': false + }) + ); + await Ractive.sharedSet('screenSize', screenSize); + await Ractive.sharedSet(screenSize, true); + await Ractive.sharedSet('widthLevel', widthLevel); + }; + const updateResize = debounce(app.updateResize, 250); + function calculateScreen() { + requestAnimationFrame(updateResize); + } + eventAdd$1( + window, + 'resize', + () => { + calculateScreen(); + }, + true + ); + const smoothScroll = (element, to, duration) => { + if (duration <= 0) { + return; + } + const difference = to - element.scrollTop; + const perTick = (difference / duration) * 10; + requestAnimationFrame(() => { + element.scrollTop = element.scrollTop + perTick; + if (element.scrollTop === to) { + return; + } + smoothScroll(element, to, duration - 10); + }); + }; + const mobileCheck = () => { + let check = false; + const a = navigator.userAgent || navigator.vendor || window.opera; + if ( + (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i).test( + a + ) || + (/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw(n|u)|c55\/|capi|ccwa|cdm|cell|chtm|cldc|cmd|co(mp|nd)|craw|da(it|ll|ng)|dbte|dcs|devi|dica|dmob|do(c|p)o|ds(12|d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(|_)|g1 u|g560|gene|gf5|gmo|go(\.w|od)|gr(ad|un)|haie|hcit|hd(m|p|t)|hei|hi(pt|ta)|hp( i|ip)|hsc|ht(c(| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i(20|go|ma)|i230|iac( ||\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|[a-w])|libw|lynx|m1w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|mcr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|([1-8]|c))|phil|pire|pl(ay|uc)|pn2|po(ck|rt|se)|prox|psio|ptg|qaa|qc(07|12|21|32|60|[2-7]|i)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h|oo|p)|sdk\/|se(c(|0|1)|47|mc|nd|ri)|sgh|shar|sie(|m)|sk0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h|v|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl|tdg|tel(i|m)|tim|tmo|to(pl|sh)|ts(70|m|m3|m5)|tx9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas|your|zeto|zte/i).test( + a.substr(0, 4) + ) + ) { + check = true; + } + return check; + }; + const tabletCheck = () => { + return (/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/).test( + navigator.userAgent.toLowerCase() + ); + }; + app.initializeScreen = async () => { + const isMobile = mobileCheck(); + const isTablet = tabletCheck(); + if (isMobile) { + await Ractive.sharedSet('classes.mobile', true); + await Ractive.sharedSet('mobile', true); + } + if (isTablet) { + await Ractive.sharedSet('classes.tablet', true); + await Ractive.sharedSet('tablet', true); + } + if (!isMobile && !isTablet) { + await Ractive.sharedSet('classes.desktop', true); + await Ractive.sharedSet('desktop', true); + } + await Ractive.sharedSet('classes.chrome', isAgent.chrome); + await Ractive.sharedSet('classes.android', isAgent.android); + await Ractive.sharedSet('classes.linux', isAgent.linux); + await Ractive.sharedSet('classes.mozilla', isAgent.mozilla); + await Ractive.sharedSet('classes.applewebkit', isAgent.applewebkit); + await app.updateResize(); + }; + model('smoothScroll', smoothScroll); + window.Ractive.prototype.data = { + $: app.utility, + getComponent(partialName) { + const componentName = partialName; + const partial = `<${partialName} />`; + console.log(componentName); + const partialsCheck = Boolean(this.partials[partialName]); + if (!partialsCheck) { + this.partials[partialName] = partial; + } + return partialName; + }, + makePartial(id, template) { + const key = `partial-${id}`; + const partialsCheck = Boolean(this.partials[id]); + if (partialsCheck) { + return key; + } + this.partials[key] = template; + return key; + } + }; + const { + utility: { + findIndex, + hasValue: hasValue$1, + get: get$1, + isPlainObject, + findItem, + assignDeep: assignDeep$1, + ensureArray: ensureArray$1, + assign: assign$4, + each: each$8, + isArray: isArray$1, + isEmpty, + sortNewest, + sortOldest, + clear + } + } = app; + const extendRactive = { + async afterIndex(path, indexMatch, item, indexName) { + const index = findIndex(this.get(path), indexMatch, indexName); + if (hasValue$1(index)) { + await this.splice(path, index + 1, 0, ...ensureArray$1(item)); + } else { + await this.push(path, item); + } + }, + async assign(path, mergeObject) { + const item = this.get(path); + if (hasValue$1(item)) { + assignDeep$1(item, mergeObject); + await this.update(path); + return item; + } + }, + async beforeIndex(path, indexMatch, item, indexName) { + const index = findIndex(this.get(path), indexMatch, indexName); + if (hasValue$1(index)) { + await this.splice(path, index - 1, 0, ...ensureArray$1(item)); + } else { + await this.push(path, item); + } + }, + async clearArray(path) { + const arrayToClear = this.get(path); + if (arrayToClear) { + clear(arrayToClear); + await this.update(path); + } + }, + findItem(path, indexMatch, indexName) { + const item = find(this.get(path), indexMatch, indexName); + if (hasValue$1(item)) { + return item; + } + }, + getIndex(path, indexMatch, indexName) { + const index = findIndex(this.get(path), indexMatch, indexName); + if (hasValue$1(index)) { + return index; + } + }, + async mergeItem(path, indexMatch, newVal, indexName) { + const item = findItem(this.get(path), indexMatch, indexName); + if (hasValue$1(item)) { + assignDeep$1(item, newVal); + await this.update(path); + return item; + } + }, + async removeIndex(path, indexMatch, indexName) { + const index = findIndex(this.get(path), indexMatch, indexName); + if (hasValue$1(index)) { + await this.splice(path, index, 1); + } + }, + async setIndex(path, indexMatch, item, indexName, optionsArg) { + const options = optionsArg || {}; + const index = findIndex(this.get(path), indexMatch, indexName); + if (hasValue$1(index)) { + const pathSuffix = options.pathSuffix ? `.${options.pathSuffix}` : ''; + await this.set(`${path}.${index}${pathSuffix}`, item); + } else if (get$1('conflict', options) === 'insert') { + await this[get$1('conflictMethod', options) || 'push'](path, item); + } + }, + async sortNewest(path, property) { + const array = this.get(path); + sortNewest(array, property, true); + await this.update(path); + }, + async sortOldest(path, property) { + const array = this.get(path); + sortOldest(array, property, true); + await this.update(path); + }, + async syncCollection(path, newValArg, type = 'push', indexName = 'id') { + const oldVal = this.get(path); + if (isPlainObject(oldVal)) { + assignDeep$1(oldVal, newValArg); + } else { + const newVal = ensureArray$1(newValArg); + each$8(newVal, (item) => { + const oldValItem = findItem(oldVal, item[indexName], indexName); + if (hasValue$1(oldValItem)) { + assign$4(oldValItem, item); + } else { + oldVal[type](item); + } + }); + } + await this.update(path); + }, + async toggleIndex(path, indexMatchArg, pathSuffixArg, indexName) { + let indexMatch; + const arrayCheck = isArray$1(indexMatchArg); + if (arrayCheck && !isEmpty(indexMatchArg)) { + indexMatch = indexMatchArg.shift(); + } else { + indexMatch = indexMatchArg; + } + const index = findIndex(this.get(path), indexMatch, indexName); + if (hasValue$1(index)) { + const pathSuffix = pathSuffixArg ? `.${pathSuffixArg}` : ''; + await this.toggle(`${path}.${index}${pathSuffix}`); + } + if (arrayCheck && !isEmpty(indexMatchArg)) { + await this.toggleIndex(path, indexMatchArg, pathSuffixArg, indexName); + } + }, + async updateItem(path, indexMatch, react, indexName) { + const item = findItem(this.get(path), indexMatch, indexName); + if (hasValue$1(item)) { + react(item); + await this.update(path); + return item; + } + } + }; + assign$4(Ractive.prototype, extendRactive); + const getComponentName = (componentModel, componentName) => { + return componentModel === app.router.currentStateObject ? 'navState' : componentName; + }; + const { + watch: watch$2, + demand: demand$3, + utility: { + each: each$7, isFunction: isFunction$1 + }, + crate + } = app; + const onHtml = async (matchFilename, componentName, json) => { + const type = json.type; + const filePath = json.name; + if (app.debug) { + console.log('WATCH HTML', matchFilename, json); + } + if (!filePath.includes(matchFilename)) { + return; + } + const html = await demand$3(filePath); + crate.setItem(filePath, html); + if (app.debug) { + console.log(type, filePath, html); + } + if (isFunction$1(componentName)) { + componentName(html); + } else { + each$7(app.view.findAllComponents(componentName), (item) => { + if (app.debug) { + console.log(item); + } + item.resetTemplate(html); + }); + } + window.UIkit.update(document.body, 'update'); + }; + const watchHtml = (matchFilename, componentName) => { + if (app.debug) { + console.log('WATCH HTML', matchFilename); + } + return watch$2(matchFilename, (json) => { + onHtml(matchFilename, componentName, json); + }); + }; + watch$2.html = watchHtml; + const { + utility: { + each: each$6 + } + } = app; + const importPartials = (componentName, componentModel, asset) => { + if (asset.partials) { + each$6(asset.partials, (item, key) => { + watchHtml(item.includes('.html') ? item : `${item}.html`, (html) => { + const realName = getComponentName(componentModel, componentName); + each$6(app.view.findAllComponents(realName), (subItem) => { + subItem.resetPartial(key, html); + }); + }); + }); + } + }; + const importTemplate = (componentName, componentModel, asset) => { + let template = asset.template; + if (!template.includes('.html') && !template.includes('.hbs') && !template.includes('.mustache')) { + template = asset.template = asset.template = `${template}.html`; + } + if (template) { + watchHtml(template, (html) => { + const realName = getComponentName(componentModel, componentName); + if (realName) { + const matchedComponent = app.view.findComponent(realName); + if (matchedComponent) { + matchedComponent.resetTemplate(html); + } + } + }); + } + }; + const { + utility: { + each: each$5, isString: isString$3, isArray, apply: apply$3 + } + } = app; + const logMulti = console; + function debugMultiEvent(...args) { + if (app.debug || app.debugMultiEvent) { + apply$3(logMulti.log, logMulti, args); + } + } + const multiEvent = (currentView, componentEvent, events, ...args) => { + debugMultiEvent(currentView, componentEvent, events); + debugMultiEvent(args); + if (componentEvent && events.length) { + const { + original + } = componentEvent; + original.preventDefault(); + original.stopPropagation(); + } + if (events) { + if (isString$3(events)) { + each$5(events.split(','), (subItem) => { + if (subItem) { + currentView.fire(subItem.trim(), componentEvent, ...args); + } + }); + } else if (isArray(events)) { + each$5(events, (item) => { + if (item) { + each$5(item.split(','), (subItem) => { + if (subItem) { + currentView.fire(subItem.trim(), componentEvent, ...args); + } + }); + } + }); + } + } + }; + const { + utility: { + each: each$4, assign: assign$3, querySelector: querySelector$1 + } + } = app; + const headNode = querySelector$1('head'); + const importedCssCount = {}; + const importedCss = {}; + const render = (code, filePath) => { + if (importedCss[filePath]) { + importedCssCount[filePath]++; + } else { + importedCssCount[filePath] = 0; + const node = document.createElement('style'); + node.innerHTML = code; + node.setAttribute('data-src', filePath); + headNode.appendChild(node); + importedCss[filePath] = node; + } + }; + const unrender = (code, filePath) => { + if (importedCss[filePath]) { + importedCssCount[filePath]--; + if (importedCssCount[filePath] < 0) { + importedCss[filePath].remove(); + importedCss[filePath] = null; + importedCssCount[filePath] = null; + } + } + }; + const cssRender = (css) => { + if (css) { + each$4(css, render); + } + }; + const cssUnrender = (css) => { + if (css) { + each$4(css, unrender); + } + }; + const componentsWithCss = {}; + const registerCssComponent = (css, componentConfig) => { + if (!css) { + return; + } + each$4(css, (item, key) => { + if (!componentsWithCss[key]) { + componentsWithCss[key] = []; + } + componentsWithCss[key].push(componentConfig); + }); + }; + assign$3(app, { + componentsWithCss, + importedCss, + importedCssCount + }); + const { + watch: watch$1, + utility: { + each: each$3, get, apply: apply$2 + } + } = app; + const createWatchers = (currentView, item, key) => { + if (get('isWatcher', item._)) { + currentView.watchers[key] = item; + return; + } + item.options = item.options || {}; + item.methods = item.methods || {}; + let { + prefix, suffix + } = item.options; + const { + methods + } = item; + const createMethod = methods.create || 'push'; + const readMethod = methods.read || 'push'; + prefix = prefix ? `${prefix}.` : ''; + suffix = suffix ? `.${suffix}` : ''; + item.prefix = prefix; + item.suffix = suffix; + currentView.watchers[key] = watch$1( + { + async create(json) { + await currentView.syncCollection(key, json.item, createMethod); + currentView.fire(`${prefix}create${suffix}`, json.item, json); + }, + async delete(json) { + await currentView.removeIndex(key, json.item.id); + currentView.fire(`${prefix}delete${suffix}`, json.item, json); + }, + async read(json) { + await currentView.syncCollection(key, json.items, readMethod); + currentView.fire(`${prefix}read${suffix}`, json.item, json); + }, + async update(json) { + await currentView.syncCollection(key, json.item, createMethod); + currentView.fire(`${prefix}update${suffix}`, json.item, json); + } + }, + item.options + ); + }; + const removeInstance = function(currentView, css) { + cssUnrender(css); + each$3(currentView.watchers, (item, key) => { + item.stop(); + item[key] = null; + }); + }; + const onrenderInstance = function(currentView, css) { + cssRender(css); + if (currentView.watchers) { + each$3(currentView.watchers, (item) => { + item.start(); + }); + } + }; + const buildComponentEvents = function(componentConfig) { + const { + css, watchers + } = componentConfig; + const thisComponent = this; + thisComponent.watchers = watchers ? watchers(thisComponent) : {}; + if (thisComponent.watchers) { + each$3(thisComponent.watchers, (item, key) => { + createWatchers(thisComponent, item, key); + }); + } + thisComponent.on({ + multi(cmpntEvent, ...args) { + if (app.debug) { + console.log(cmpntEvent, ...args); + } + return multiEvent(this, cmpntEvent, ...args); + }, + render() { + return onrenderInstance(this, css); + }, + teardown() { + return removeInstance(this, css); + } + }); + }; + const onConstruct = function(componentConfig) { + const sourceConstruct = componentConfig.onconstruct; + componentConfig.onconstruct = function(...args) { + apply$2(buildComponentEvents, this, [componentConfig, ...args]); + if (sourceConstruct) { + return apply$2(sourceConstruct, this, args); + } + }; + const sourceRender = componentConfig.onrender; + componentConfig.onrender = function(...args) { + if (sourceRender) { + return apply$2(sourceRender, this, args); + } + }; + }; + const { + utility: { + cnsl: cnsl$1, assign: assign$2 + } + } = app; + cnsl$1('viewSetup Module', 'notify'); + const initializeComponent = (componentConfig) => { + componentConfig.decorators = assign$2(componentConfig.decorators || {}, {}); + const { + css, model: componentModel, asset, name: componentName + } = componentConfig; + registerCssComponent(css, componentConfig); + if (asset && (componentName || componentModel)) { + importTemplate(componentName, componentModel, asset); + importPartials(componentName, componentModel, asset); + } + onConstruct(componentConfig); + }; + const { + utility: { + omit + } + } = app; + const buildComponent = (componentConfig) => { + initializeComponent(componentConfig); + const { + name: componentName, model + } = componentConfig; + const cmpntConfigClean = omit(componentConfig, ['css', 'asset']); + if (componentConfig.CSS) { + cmpntConfigClean.css = componentConfig.CSS; + } + const Component = Ractive.extend(cmpntConfigClean); + if (componentName) { + Ractive.components[componentName] = Component; + } + if (model) { + model.component = Component; + } + return Component; + }; + const { + demand: demand$2, demandCss, demandHtml, + utility: { + assign: assign$1, each: each$2, ensureArray, isString: isString$2 + } + } = app; + const asyncComponent = async function(componentConfig) { + const componentModel = componentConfig.model; + let asset = componentConfig.asset || {}; + if (isString$2(asset)) { + asset = { + css: [`${asset}style`], + template: `${asset}template` + }; + } + componentConfig.asset = asset; + componentConfig.css = componentConfig.css || {}; + componentConfig.partials = componentConfig.partials || {}; + if (asset) { + if (asset.template) { + componentConfig.template = await demandHtml(asset.template); + } + if (asset.demand) { + componentConfig.demand = await demand$2(asset.demand); + } + if (asset.partials) { + assign$1(componentConfig.partials, await demandHtml(asset.partials)); + } + if (asset.css) { + const assetCss = asset.css; + const loadCss = await demandCss(assetCss); + each$2(ensureArray(loadCss), (item, index) => { + let keyName = assetCss[index]; + if (!keyName.includes('.css')) { + keyName = `${keyName}.css`; + } + componentConfig.css[keyName] = item; + }); + } + } + const componentPromise = buildComponent(componentConfig); + if (componentModel) { + componentModel.component = componentPromise; + } + return componentPromise; + }; + const { + utility: { + isString: isString$1 + } + } = app; + const components = {}; + const generateComponent = (ComponentView, config) => { + return new ComponentView(config); + }; + const getComponent = (componentName, config) => { + const componentObject = components[componentName]; + return config ? generateComponent(componentObject, config) : componentObject; + }; + const component$1 = (componentName, componentConfigOption) => { + let method; + const componentConfig = componentConfigOption ? componentConfigOption : componentName; + if (isString$1(componentName)) { + componentConfig.name = componentName; + } + console.log(componentConfig); + if (componentConfig.asset) { + method = asyncComponent; + } else { + method = buildComponent; + } + return method(componentConfig); + }; + app.component = component$1; + app.getComponent = getComponent; + const { + demand: demand$1, + watch, + utility: { + each: each$1, querySelector, isDom + } + } = app; + const onCss = async (json) => { + const filePath = json.name; + const componentName = json.type; + const componentsUsingCss = componentsWithCss[filePath]; + console.log('CSS UPDATE', filePath, componentsUsingCss); + const node = importedCss[filePath] || importedCss[componentName] || querySelector(`[data-src="${filePath}"]`); + if (node || componentsUsingCss) { + const content = await demand$1(filePath); + if (isDom(node)) { + node.innerHTML = content; + } + if (componentsUsingCss) { + each$1(componentsUsingCss, (item) => { + console.log(item); + item.css[filePath] = content; + }); + } + } + }; + watch(/\.css/, onCss); + const { + demand, + utility: { + assign, each, isFunction + } + } = app; + const view = new Ractive({ + data() { + return { + notification: [], + screenSize: '' + }; + }, + template: `{{#@shared.components.main:key}}{{>getComponent(key)}}{{/}}` + }); + view.on({ + async '*.loadComponent'(componentEvent) { + const imported = await demand(componentEvent.get('demand')); + const afterDemand = componentEvent.get('afterDemand'); + if (afterDemand) { + const afterDemandEvents = afterDemand[componentEvent.original.type]; + each(afterDemandEvents, (item, key) => { + if (isFunction(item)) { + item(imported, item, key); + } else { + app.view.findComponent(key).fire(item); + } + }); + } + }, + '*.preventDefault'(context) { + const { + original + } = context; + original.preventDefault(); + original.stopPropagation(); + } + }); + app.importComponent = async (componentName, importURL, type = 'dynamic') => { + if (importURL) { + await demand(importURL); + } + await view.set(`@shared.components.${type}.${componentName}`, true); + await view.update('@shared.components.${type}'); + }; + app.title = new Ractive({ + target: 'head', + append: true, + data() { + return {}; + }, + template: `{{@shared.pageTitle}}` + }); + assign(app, { + async render() { + await Ractive.sharedSet('components', { + dynamic: {}, + layout: {}, + main: {} + }); + await app.initializeScreen(); + await view.render('body'); + }, + view + }); + localStorage.clear(); + const { demandJs, - demandLang + utility: { + cnsl, assignDeep, mapArray, map, isString, rest, camelCase, eventAdd, apply: apply$1, isRegExp, mapWhile, ifInvoke, hasValue, last + }, + component + } = app; + cnsl('ROUTER ONLINE', 'important'); + class Router { + constructor() { + return this; + } + debug = false; + hostname = location.hostname; + pathname = location.pathname; + navHistory = []; + historyIndex = 0; + routes = []; + methods = {}; + defaults = { + protected: false, + role: false + }; + state; + log(...args) { + if (this.debug || app.debug) { + apply$1(console.log, console, args); + } + } + popstate(popstateEvent) { + app.router.log('popstate', popstateEvent); + popstateEvent.preventDefault(); + app.router.process(); + } + pushState(url) { + history.pushState({}, url, url); + app.router.process(); + } + installRoute(routeModel) { + app.router.log('Install Route', routeModel); + const { + match + } = routeModel; + if (match) { + routeModel.regex = isRegExp(match) ? match : new RegExp(match); + } + return app.router.routes.push(routeModel); + } + add(item) { + this.log('add routes', item); + return mapArray(item, this.installRoute); + } + async setup(options) { + this.log('setup router'); + this.add(options.routes); + this.log('assign options'); + assignDeep(this, options); + this.log('eventAdd popstate'); + eventAdd(window, 'popstate', this.popstate, true); + await this.process(); + } + async updateLocation() { + map(location, (item, index) => { + if (isString(item)) { + this[index] = item; + } + }); + this.pathScored = this.pathname.replace(/\//g, '_'); + this.paths = rest(this.pathname.split('/')); + this.pathCamel = camelCase(this.paths.join('_')); + this.navHistory.push(this.pathname); + this.historyIndex++; + } + async compilePath() { + const { + route, secured, role, path + } = this.pathState; + this.log(this.pathState); + if (route) { + this.pathState.path = route(); + } else if (!path) { + this.pathState.path = this.pathname; + } + if (last(this.pathState.path) !== '/') { + this.pathState.path = `${this.pathState.path}/`; + } + if (this.pathState.path[0] !== '/') { + this.pathState.path = `/${this.pathState.path}`; + } + if (secured) { + const securityCheck = Boolean(await this.methods.security(this.match)); + if (securityCheck) { + const success = await this.methods.success(); + if (role) { + this.pathState.path = `${path}${success}/`; + } + } else { + this.pathState.path = `/${await this.methods.fail()}/`; + } + } + this.pathState.path = `/${this.defaults.root}${this.pathState.path}index`; + } + checkMatch(routeObject) { + const check = routeObject.regex.test(app.router.pathname); + if (check) { + app.router.routeState = routeObject; + } + app.router.log(check, app.router.pathname, routeObject.regex); + return !check; + } + async close() { + const currentComponent = this.component; + if (currentComponent) { + console.log('Close Component', this, currentComponent); + await app.view.findComponent('navstate').teardown(); + this.component = null; + } + } + async process() { + app.view.fire('router.loading'); + this.log('Router Loading State'); + this.updateLocation(); + this.log(this.routes); + mapWhile(this.routes, this.checkMatch); + const match = app.router.routeState; + this.log('Match found', match); + if (match) { + await this.close(); + const { + path, route + } = match; + const secured = hasValue(match.secured) ? match.secured : this.defaults.secured; + const role = hasValue(match.role) ? match.role : this.defaults.role; + const pathState = { + match, + secured, + role, + path, + route + }; + this.pathState = pathState; + this.match = match; + await this.compilePath(); + await Ractive.sharedSet('@shared.currentPath', this.pathname); + await Ractive.sharedSet('navState', false); + this.log('Checking if Model Loaded', match.model); + if (!match.model) { + if (match.assets) { + if (match.assets.scripts) { + await demandJs(match.assets.scripts); + } + } + this.log('match model', pathState.path); + match.model = await demandJs(pathState.path); + this.log(match.model); + } + this.state = match; + const initializeComponent = await component(match.model.component); + this.log('component made', initializeComponent); + Ractive.components.navstate = initializeComponent; + ifInvoke(match.model.open); + ifInvoke(this.methods.onLoad); + await Ractive.sharedSet('navState', true); + } else { + return false; + } + this.log('Finished processing'); + } + back() { + this.log('Router back State'); + const navHistory = this.navHistory; + if (navHistory.length) { + router.historyIndex--; + window.history.back(); + } + } + forward() { + this.log('Router forward State'); + const navHistory = this.navHistory; + if (navHistory.length > this.historyIndex) { + router.historyIndex++; + window.history.forward(); + } + } + } + app.router = new Router(); + app.view.on({ + '*.routerBack'() { + app.router.back(); + }, + '*.routerForward'() { + app.router.forward(); + }, + '*.route'(componentEvent) { + const { + original, node + } = componentEvent; + const url = componentEvent.get('href') || node.getAttribute('href') || node.getAttribute('data-href'); + original.preventDefault(); + app.router.log(componentEvent, url); + app.router.pushState(url); + return false; + } }); })(); diff --git a/uwBridge/system/compile/build/front/coreBundle.js b/uwBridge/system/compile/build/front/coreBundle.js index 430c7516..d4b06a59 100644 --- a/uwBridge/system/compile/build/front/coreBundle.js +++ b/uwBridge/system/compile/build/front/coreBundle.js @@ -4,6 +4,17 @@ start(data) { return app.workerRequest('configure', data); }, + log(...args) { + if (app.debug) { + apply(console.log, console, args); + } + }, + security: { + clear() { + app.log('Cleanup'); + app.crate.clear(); + } + }, utility: window.$ }; window.app = app; @@ -64,7 +75,7 @@ }; app.isEventNode = isEventNodeMethod; const { - last: last$1, first + last: last$2, first } = app.utility; const isLang = new RegExp(/^language\//); const languagePath = (filePath) => { @@ -75,7 +86,7 @@ } filePathCompiled = `language${filePathCompiled}`; } - if (last$1(filePathCompiled) !== '/') { + if (last$2(filePathCompiled) !== '/') { filePathCompiled = `${filePathCompiled}/`; } return `${filePathCompiled}${app.systemLanguage}.json`; @@ -83,7 +94,7 @@ app.languagePath = languagePath; const { utility: { - hasValue: hasValue$2, promise: promise$1, uid, isString: isString$3 + hasValue: hasValue$4, promise: promise$1, uid, isString: isString$7 } } = app; const mainWorker = new Worker('/worker.js'); @@ -124,14 +135,14 @@ id, data } = eventData; let generatedId = id; - if (!hasValue$2(generatedId)) { + if (!hasValue$4(generatedId)) { generatedId = '_'; } if (!app.events[generatedId]) { console.log(id, generatedId); } app.events[generatedId](data); - if (!eventData.keep && !isString$3(generatedId)) { + if (!eventData.keep && !isString$7(generatedId)) { app.events[generatedId] = null; uid.free(generatedId); } @@ -141,13 +152,13 @@ }; app.workerRequest = workerRequest; const { - assign: assign$3, querySelector, map: map$1, hasValue: hasValue$1, isString: isString$2 + assign: assign$9, querySelector: querySelector$2, map: map$2, hasValue: hasValue$3, isString: isString$6 } = app.utility; const { - crate: crate$1 + crate: crate$2 } = app; const imported = {}; - const headNode = querySelector('head'); + const headNode$1 = querySelector$2('head'); const styleNode = document.createElement('style'); const loadScript = window.eval; const iJson = (contents) => { @@ -158,13 +169,13 @@ }; const isLibRegex = new RegExp(/^js\/lib\//); const checksumReturn = (item) => { - return crate$1.getItem(`cs-${item}`); + return crate$2.getItem(`cs-${item}`); }; const constructStyleTagThenAppendToHead = (text, filePath) => { const node = styleNode.cloneNode(false); node.textContent = text; node.setAttribute('data-src', filePath); - headNode.appendChild(node); + headNode$1.appendChild(node); return node; }; /* @@ -177,7 +188,7 @@ const { callback, data } = config; - const assetCollection = map$1(data, getLoadedAssets); + const assetCollection = map$2(data, getLoadedAssets); callback(...assetCollection); }; const checkIfCompleted = (config) => { @@ -198,16 +209,16 @@ let skipCheck; if (fileContents === true) { if (!imported[filename]) { - fileContents = crate$1.getItem(filename); + fileContents = crate$2.getItem(filename); } } else if (fileContents !== false) { if (app.debug) { console.log('SAVE FILE TO LOCAL', fileContents); } - crate$1.setItem(`cs-${filename}`, cs); - crate$1.setItem(filename, fileContents); + crate$2.setItem(`cs-${filename}`, cs); + crate$2.setItem(filename, fileContents); } - if (!hasValue$1(imported[filename]) || fileContents !== true) { + if (!hasValue$3(imported[filename]) || fileContents !== true) { if (!isJs) { if (fileContents === false) { imported[filename] = {}; @@ -235,7 +246,7 @@ } } } - if (isCss && appendCSS && isString$2(imported[filename])) { + if (isCss && appendCSS && isString$6(imported[filename])) { constructStyleTagThenAppendToHead(imported[filename], filename); imported[filename] = true; } @@ -250,30 +261,26 @@ config.fileCount = config.data.length; await workerRequest({ async callback(json) { - if (hasValue$1(json.file)) { - try { - await saveCompleted(json, config); - } catch (err) { - console.log(config, json.file); - } + if (hasValue$3(json.file)) { + await saveCompleted(json, config); } else { return checkIfCompleted(config); } }, data: { data: { - cs: map$1(configData, checksumReturn), + cs: map$2(configData, checksumReturn), files: configData } }, request: 'socket.get' }); }; - assign$3(app, { + assign$9(app, { fetchFile }); const { - assign: assign$2 + assign: assign$8 } = app.utility; const request = async (requestName, config) => { const requestPackage = config ? @@ -296,43 +303,43 @@ const json = await workerRequest(workerPackage); return json; }; - assign$2(app, { + assign$8(app, { request }); const { utility: { - assign: assign$1, - cnsl: cnsl$1, + assign: assign$7, + cnsl: cnsl$3, compactMapArray, - isEmpty, + isEmpty: isEmpty$1, eachAsync, eachObject, eachArray, - isString: isString$1, - isPlainObject: isPlainObject$1, - hasValue, + isString: isString$5, + isPlainObject: isPlainObject$2, + hasValue: hasValue$2, drop } } = app; - cnsl$1('Initilizing watchers module.', 'notify'); + cnsl$3('Initilizing watchers module.', 'notify'); const watchers = {}; const watchersRegex = []; const onRegex = (type, callable) => { const watchObject = {}; callable.regex = type; let number = watchersRegex.push(callable) - 1; - assign$1(watchObject, { + assign$7(watchObject, { _: { isWatcher: true }, callable, start() { - if (!hasValue(number)) { + if (!hasValue$2(number)) { number = watchersRegex.push(callable) - 1; } }, stop() { - if (hasValue(number)) { + if (hasValue$2(number)) { drop(watchersRegex, number); number = null; } @@ -347,18 +354,18 @@ } const levelObject = watchers[type]; let number = levelObject.push(callable) - 1; - assign$1(watchObject, { + assign$7(watchObject, { _: { isWatcher: true }, callable, start() { - if (!hasValue(number)) { + if (!hasValue$2(number)) { number = levelObject.push(callable) - 1; } }, stop() { - if (hasValue(number)) { + if (hasValue$2(number)) { drop(levelObject, number); number = null; } @@ -391,26 +398,26 @@ }); return watchCollection; }; - const watch = (type, callable) => { + const watch$3 = (type, callable) => { let method; - if (isString$1(type)) { + if (isString$5(type)) { method = onString; - } else if (isPlainObject$1(type)) { + } else if (isPlainObject$2(type)) { method = onCollection; } else { method = onRegex; } return method(type, callable); }; - watch.status = true; - watch.start = () => { - watch.status = true; + watch$3.status = true; + watch$3.start = () => { + watch$3.status = true; }; - watch.stop = () => { - watch.status = null; + watch$3.stop = () => { + watch$3.status = null; }; const onUpdate = async (json) => { - if (!watch.status || !json) { + if (!watch$3.status || !json) { return; } const type = json.type; @@ -421,7 +428,7 @@ return item; } }); - if (!isEmpty(regexSubscribers)) { + if (!isEmpty$1(regexSubscribers)) { subscribers.push(...regexSubscribers); } if (levelObject) { @@ -441,21 +448,31 @@ request: requestName }); }; - assign$1(app.events, { + assign$7(app.events, { _(json) { return onUpdate(json.data); } }); - assign$1(app, { + assign$7(app, { push, - watch, + watch: watch$3, watchers }); const { utility: { - assign, hasDot, promise, last, map, isString, isPlainObject, each, cnsl, initialString, restString + assign: assign$6, + hasDot, + promise, + last: last$1, + map: map$1, + isString: isString$4, + isPlainObject: isPlainObject$1, + each: each$9, + cnsl: cnsl$2, + initialString, + restString }, - crate + crate: crate$1 } = app; const commaString = ','; const buildFilePath = (itemArg) => { @@ -463,7 +480,7 @@ if (!hasDot(item)) { if (initialString(item, -9) === 'language/') { item = languagePath(item); - } else if (last(item) === '/') { + } else if (last$1(item) === '/') { item += 'index.js'; } else if (initialString(item, -3) === 'js/') { item += '.js'; @@ -476,15 +493,15 @@ } if (restString(item, -3) === '.js') { if (app.debug) { - console.log(item, watch); + console.log(item, watch$3); } if (!watchers[item]) { - watch(item, (thing) => { + watch$3(item, (thing) => { if (app.debug) { console.log('Live Reload', thing); } - crate.removeItem(thing.name); - crate.removeItem(`cs-${thing.name}`); + crate$1.removeItem(thing.name); + crate$1.removeItem(`cs-${thing.name}`); }); } } @@ -494,7 +511,7 @@ return items[0]; }; const objectDemand = (items, arrayToObjectMap) => { - return map(arrayToObjectMap, (item) => { + return map$1(arrayToObjectMap, (item) => { return items[item]; }); }; @@ -504,7 +521,7 @@ const streamAssets = (data, options) => { return promise((accept) => { fetchFile( - assign( + assign$6( { callback(...args) { accept(args); @@ -516,24 +533,24 @@ ); }); }; - const demand = async (filesArg, options) => { + const demand$4 = async (filesArg, options) => { const assets = []; let demandType; let arrayToObjectMap; let files = filesArg; - if (isPlainObject(files)) { + if (isPlainObject$1(files)) { demandType = objectDemand; arrayToObjectMap = {}; let index = 0; - each(files, (item, key) => { + each$9(files, (item, key) => { arrayToObjectMap[key] = index; index++; assets.push(buildFilePath(item)); }); } else { - files = isString(files) ? files.split(commaString) : files; + files = isString$4(files) ? files.split(commaString) : files; demandType = files.length < 2 ? singleDemand : multiDemand; - each(files, (item) => { + each$9(files, (item) => { assets.push(buildFilePath(item)); }); } @@ -543,53 +560,1028 @@ const demandTypeMethod = (type, optionsFunction) => { return function(filesArg, options) { let files = filesArg; - if (isString(files)) { + if (isString$4(files)) { files = files.split(commaString); } if (optionsFunction) { optionsFunction(options); } - files = map(files, (itemArg) => { + files = map$1(files, (itemArg) => { let item = itemArg; - if (type === 'js' && last(item) === '/') { + if (type === 'js' && last$1(item) === '/') { item += 'index'; } return `${item}.${type}`; }); - return demand(files, options); + return demand$4(files, options); }; }; - const demandCss = demandTypeMethod('css', (appendCSS) => { + const demandCss$1 = demandTypeMethod('css', (appendCSS) => { return { appendCSS }; }); - const demandJs = demandTypeMethod('js'); - const demandHtml = demandTypeMethod('html'); + const demandJs$1 = demandTypeMethod('js'); + const demandHtml$1 = demandTypeMethod('html'); const demandLang = (fileList) => { - const files = isString(fileList) ? fileList.split(commaString) : fileList; - return demand(map(files, languagePath)); + const files = isString$4(fileList) ? fileList.split(commaString) : fileList; + return demand$4(map$1(files, languagePath)); }; - assign(app.events, { + assign$6(app.events, { async setupCompleted(data) { - cnsl('Worker is Ready', 'notify'); + cnsl$2('Worker is Ready', 'notify'); app.systemLanguage = data.language; try { - await demand('Sentivate/'); - app.translate = await demand('language/global'); - await demand('app/'); + await demand$4('app/'); } catch (error) { console.log(error); - crate.clear(); + crate$1.clear(); window.location.reload(); } } }); - assign(app, { - demand, + assign$6(app, { + demand: demand$4, + demandCss: demandCss$1, + demandHtml: demandHtml$1, + demandJs: demandJs$1, + demandLang + }); + const spawnNotification = (data) => {}; + app.notify = async (data) => { + if (Notification.permission === 'granted') { + return spawnNotification(); + } else if (Notification.permission !== 'denied') { + await Notification.requestPermission(); + } + }; + const { + utility: { + debounce, eventAdd: eventAdd$1, isAgent, info, model, assign: assign$5 + } + } = app; + app.updateResize = async () => { + await Ractive.sharedSet(info); + const width = info.windowWidth; + let widthLevel = 0; + let screenSize; + if (width < 640) { + screenSize = 'miniScreen'; + } else if (width < 740) { + screenSize = 'tinyScreen'; + widthLevel = 1; + } else if (width < 1024) { + screenSize = 'smallScreen'; + widthLevel = 2; + } else if (width < 1920) { + screenSize = 'mediumScreen'; + widthLevel = 3; + } else if (width < 3000) { + screenSize = 'hdScreen'; + widthLevel = 4; + } else if (width > 3000) { + screenSize = '4kScreen'; + widthLevel = 5; + } + console.log(screenSize); + await Ractive.sharedSet( + assign$5(Ractive.sharedGet(), { + tinyScreen: false, + smallScreen: false, + mediumScreen: false, + hdScreen: false, + '4kScreen': false + }) + ); + await Ractive.sharedSet('screenSize', screenSize); + await Ractive.sharedSet(screenSize, true); + await Ractive.sharedSet('widthLevel', widthLevel); + }; + const updateResize = debounce(app.updateResize, 250); + function calculateScreen() { + requestAnimationFrame(updateResize); + } + eventAdd$1( + window, + 'resize', + () => { + calculateScreen(); + }, + true + ); + const smoothScroll = (element, to, duration) => { + if (duration <= 0) { + return; + } + const difference = to - element.scrollTop; + const perTick = (difference / duration) * 10; + requestAnimationFrame(() => { + element.scrollTop = element.scrollTop + perTick; + if (element.scrollTop === to) { + return; + } + smoothScroll(element, to, duration - 10); + }); + }; + const mobileCheck = () => { + let check = false; + const a = navigator.userAgent || navigator.vendor || window.opera; + if ( + (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i).test( + a + ) || + (/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw(n|u)|c55\/|capi|ccwa|cdm|cell|chtm|cldc|cmd|co(mp|nd)|craw|da(it|ll|ng)|dbte|dcs|devi|dica|dmob|do(c|p)o|ds(12|d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(|_)|g1 u|g560|gene|gf5|gmo|go(\.w|od)|gr(ad|un)|haie|hcit|hd(m|p|t)|hei|hi(pt|ta)|hp( i|ip)|hsc|ht(c(| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i(20|go|ma)|i230|iac( ||\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|[a-w])|libw|lynx|m1w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|mcr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|([1-8]|c))|phil|pire|pl(ay|uc)|pn2|po(ck|rt|se)|prox|psio|ptg|qaa|qc(07|12|21|32|60|[2-7]|i)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h|oo|p)|sdk\/|se(c(|0|1)|47|mc|nd|ri)|sgh|shar|sie(|m)|sk0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h|v|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl|tdg|tel(i|m)|tim|tmo|to(pl|sh)|ts(70|m|m3|m5)|tx9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas|your|zeto|zte/i).test( + a.substr(0, 4) + ) + ) { + check = true; + } + return check; + }; + const tabletCheck = () => { + return (/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/).test( + navigator.userAgent.toLowerCase() + ); + }; + app.initializeScreen = async () => { + const isMobile = mobileCheck(); + const isTablet = tabletCheck(); + if (isMobile) { + await Ractive.sharedSet('classes.mobile', true); + await Ractive.sharedSet('mobile', true); + } + if (isTablet) { + await Ractive.sharedSet('classes.tablet', true); + await Ractive.sharedSet('tablet', true); + } + if (!isMobile && !isTablet) { + await Ractive.sharedSet('classes.desktop', true); + await Ractive.sharedSet('desktop', true); + } + await Ractive.sharedSet('classes.chrome', isAgent.chrome); + await Ractive.sharedSet('classes.android', isAgent.android); + await Ractive.sharedSet('classes.linux', isAgent.linux); + await Ractive.sharedSet('classes.mozilla', isAgent.mozilla); + await Ractive.sharedSet('classes.applewebkit', isAgent.applewebkit); + await app.updateResize(); + }; + model('smoothScroll', smoothScroll); + window.Ractive.prototype.data = { + $: app.utility, + getComponent(partialName) { + const componentName = partialName; + const partial = `<${partialName} />`; + console.log(componentName); + const partialsCheck = Boolean(this.partials[partialName]); + if (!partialsCheck) { + this.partials[partialName] = partial; + } + return partialName; + }, + makePartial(id, template) { + const key = `partial-${id}`; + const partialsCheck = Boolean(this.partials[id]); + if (partialsCheck) { + return key; + } + this.partials[key] = template; + return key; + } + }; + const { + utility: { + findIndex, + hasValue: hasValue$1, + get: get$1, + isPlainObject, + findItem, + assignDeep: assignDeep$1, + ensureArray: ensureArray$1, + assign: assign$4, + each: each$8, + isArray: isArray$1, + isEmpty, + sortNewest, + sortOldest, + clear + } + } = app; + const extendRactive = { + async afterIndex(path, indexMatch, item, indexName) { + const index = findIndex(this.get(path), indexMatch, indexName); + if (hasValue$1(index)) { + await this.splice(path, index + 1, 0, ...ensureArray$1(item)); + } else { + await this.push(path, item); + } + }, + async assign(path, mergeObject) { + const item = this.get(path); + if (hasValue$1(item)) { + assignDeep$1(item, mergeObject); + await this.update(path); + return item; + } + }, + async beforeIndex(path, indexMatch, item, indexName) { + const index = findIndex(this.get(path), indexMatch, indexName); + if (hasValue$1(index)) { + await this.splice(path, index - 1, 0, ...ensureArray$1(item)); + } else { + await this.push(path, item); + } + }, + async clearArray(path) { + const arrayToClear = this.get(path); + if (arrayToClear) { + clear(arrayToClear); + await this.update(path); + } + }, + findItem(path, indexMatch, indexName) { + const item = find(this.get(path), indexMatch, indexName); + if (hasValue$1(item)) { + return item; + } + }, + getIndex(path, indexMatch, indexName) { + const index = findIndex(this.get(path), indexMatch, indexName); + if (hasValue$1(index)) { + return index; + } + }, + async mergeItem(path, indexMatch, newVal, indexName) { + const item = findItem(this.get(path), indexMatch, indexName); + if (hasValue$1(item)) { + assignDeep$1(item, newVal); + await this.update(path); + return item; + } + }, + async removeIndex(path, indexMatch, indexName) { + const index = findIndex(this.get(path), indexMatch, indexName); + if (hasValue$1(index)) { + await this.splice(path, index, 1); + } + }, + async setIndex(path, indexMatch, item, indexName, optionsArg) { + const options = optionsArg || {}; + const index = findIndex(this.get(path), indexMatch, indexName); + if (hasValue$1(index)) { + const pathSuffix = options.pathSuffix ? `.${options.pathSuffix}` : ''; + await this.set(`${path}.${index}${pathSuffix}`, item); + } else if (get$1('conflict', options) === 'insert') { + await this[get$1('conflictMethod', options) || 'push'](path, item); + } + }, + async sortNewest(path, property) { + const array = this.get(path); + sortNewest(array, property, true); + await this.update(path); + }, + async sortOldest(path, property) { + const array = this.get(path); + sortOldest(array, property, true); + await this.update(path); + }, + async syncCollection(path, newValArg, type = 'push', indexName = 'id') { + const oldVal = this.get(path); + if (isPlainObject(oldVal)) { + assignDeep$1(oldVal, newValArg); + } else { + const newVal = ensureArray$1(newValArg); + each$8(newVal, (item) => { + const oldValItem = findItem(oldVal, item[indexName], indexName); + if (hasValue$1(oldValItem)) { + assign$4(oldValItem, item); + } else { + oldVal[type](item); + } + }); + } + await this.update(path); + }, + async toggleIndex(path, indexMatchArg, pathSuffixArg, indexName) { + let indexMatch; + const arrayCheck = isArray$1(indexMatchArg); + if (arrayCheck && !isEmpty(indexMatchArg)) { + indexMatch = indexMatchArg.shift(); + } else { + indexMatch = indexMatchArg; + } + const index = findIndex(this.get(path), indexMatch, indexName); + if (hasValue$1(index)) { + const pathSuffix = pathSuffixArg ? `.${pathSuffixArg}` : ''; + await this.toggle(`${path}.${index}${pathSuffix}`); + } + if (arrayCheck && !isEmpty(indexMatchArg)) { + await this.toggleIndex(path, indexMatchArg, pathSuffixArg, indexName); + } + }, + async updateItem(path, indexMatch, react, indexName) { + const item = findItem(this.get(path), indexMatch, indexName); + if (hasValue$1(item)) { + react(item); + await this.update(path); + return item; + } + } + }; + assign$4(Ractive.prototype, extendRactive); + const getComponentName = (componentModel, componentName) => { + return componentModel === app.router.currentStateObject ? 'navState' : componentName; + }; + const { + watch: watch$2, + demand: demand$3, + utility: { + each: each$7, isFunction: isFunction$1 + }, + crate + } = app; + const onHtml = async (matchFilename, componentName, json) => { + const type = json.type; + const filePath = json.name; + if (app.debug) { + console.log('WATCH HTML', matchFilename, json); + } + if (!filePath.includes(matchFilename)) { + return; + } + const html = await demand$3(filePath); + crate.setItem(filePath, html); + if (app.debug) { + console.log(type, filePath, html); + } + if (isFunction$1(componentName)) { + componentName(html); + } else { + each$7(app.view.findAllComponents(componentName), (item) => { + if (app.debug) { + console.log(item); + } + item.resetTemplate(html); + }); + } + window.UIkit.update(document.body, 'update'); + }; + const watchHtml = (matchFilename, componentName) => { + if (app.debug) { + console.log('WATCH HTML', matchFilename); + } + return watch$2(matchFilename, (json) => { + onHtml(matchFilename, componentName, json); + }); + }; + watch$2.html = watchHtml; + const { + utility: { + each: each$6 + } + } = app; + const importPartials = (componentName, componentModel, asset) => { + if (asset.partials) { + each$6(asset.partials, (item, key) => { + watchHtml(item.includes('.html') ? item : `${item}.html`, (html) => { + const realName = getComponentName(componentModel, componentName); + each$6(app.view.findAllComponents(realName), (subItem) => { + subItem.resetPartial(key, html); + }); + }); + }); + } + }; + const importTemplate = (componentName, componentModel, asset) => { + let template = asset.template; + if (!template.includes('.html') && !template.includes('.hbs') && !template.includes('.mustache')) { + template = asset.template = asset.template = `${template}.html`; + } + if (template) { + watchHtml(template, (html) => { + const realName = getComponentName(componentModel, componentName); + if (realName) { + const matchedComponent = app.view.findComponent(realName); + if (matchedComponent) { + matchedComponent.resetTemplate(html); + } + } + }); + } + }; + const { + utility: { + each: each$5, isString: isString$3, isArray, apply: apply$3 + } + } = app; + const logMulti = console; + function debugMultiEvent(...args) { + if (app.debug || app.debugMultiEvent) { + apply$3(logMulti.log, logMulti, args); + } + } + const multiEvent = (currentView, componentEvent, events, ...args) => { + debugMultiEvent(currentView, componentEvent, events); + debugMultiEvent(args); + if (componentEvent && events.length) { + const { + original + } = componentEvent; + original.preventDefault(); + original.stopPropagation(); + } + if (events) { + if (isString$3(events)) { + each$5(events.split(','), (subItem) => { + if (subItem) { + currentView.fire(subItem.trim(), componentEvent, ...args); + } + }); + } else if (isArray(events)) { + each$5(events, (item) => { + if (item) { + each$5(item.split(','), (subItem) => { + if (subItem) { + currentView.fire(subItem.trim(), componentEvent, ...args); + } + }); + } + }); + } + } + }; + const { + utility: { + each: each$4, assign: assign$3, querySelector: querySelector$1 + } + } = app; + const headNode = querySelector$1('head'); + const importedCssCount = {}; + const importedCss = {}; + const render = (code, filePath) => { + if (importedCss[filePath]) { + importedCssCount[filePath]++; + } else { + importedCssCount[filePath] = 0; + const node = document.createElement('style'); + node.innerHTML = code; + node.setAttribute('data-src', filePath); + headNode.appendChild(node); + importedCss[filePath] = node; + } + }; + const unrender = (code, filePath) => { + if (importedCss[filePath]) { + importedCssCount[filePath]--; + if (importedCssCount[filePath] < 0) { + importedCss[filePath].remove(); + importedCss[filePath] = null; + importedCssCount[filePath] = null; + } + } + }; + const cssRender = (css) => { + if (css) { + each$4(css, render); + } + }; + const cssUnrender = (css) => { + if (css) { + each$4(css, unrender); + } + }; + const componentsWithCss = {}; + const registerCssComponent = (css, componentConfig) => { + if (!css) { + return; + } + each$4(css, (item, key) => { + if (!componentsWithCss[key]) { + componentsWithCss[key] = []; + } + componentsWithCss[key].push(componentConfig); + }); + }; + assign$3(app, { + componentsWithCss, + importedCss, + importedCssCount + }); + const { + watch: watch$1, + utility: { + each: each$3, get, apply: apply$2 + } + } = app; + const createWatchers = (currentView, item, key) => { + if (get('isWatcher', item._)) { + currentView.watchers[key] = item; + return; + } + item.options = item.options || {}; + item.methods = item.methods || {}; + let { + prefix, suffix + } = item.options; + const { + methods + } = item; + const createMethod = methods.create || 'push'; + const readMethod = methods.read || 'push'; + prefix = prefix ? `${prefix}.` : ''; + suffix = suffix ? `.${suffix}` : ''; + item.prefix = prefix; + item.suffix = suffix; + currentView.watchers[key] = watch$1( + { + async create(json) { + await currentView.syncCollection(key, json.item, createMethod); + currentView.fire(`${prefix}create${suffix}`, json.item, json); + }, + async delete(json) { + await currentView.removeIndex(key, json.item.id); + currentView.fire(`${prefix}delete${suffix}`, json.item, json); + }, + async read(json) { + await currentView.syncCollection(key, json.items, readMethod); + currentView.fire(`${prefix}read${suffix}`, json.item, json); + }, + async update(json) { + await currentView.syncCollection(key, json.item, createMethod); + currentView.fire(`${prefix}update${suffix}`, json.item, json); + } + }, + item.options + ); + }; + const removeInstance = function(currentView, css) { + cssUnrender(css); + each$3(currentView.watchers, (item, key) => { + item.stop(); + item[key] = null; + }); + }; + const onrenderInstance = function(currentView, css) { + cssRender(css); + if (currentView.watchers) { + each$3(currentView.watchers, (item) => { + item.start(); + }); + } + }; + const buildComponentEvents = function(componentConfig) { + const { + css, watchers + } = componentConfig; + const thisComponent = this; + thisComponent.watchers = watchers ? watchers(thisComponent) : {}; + if (thisComponent.watchers) { + each$3(thisComponent.watchers, (item, key) => { + createWatchers(thisComponent, item, key); + }); + } + thisComponent.on({ + multi(cmpntEvent, ...args) { + if (app.debug) { + console.log(cmpntEvent, ...args); + } + return multiEvent(this, cmpntEvent, ...args); + }, + render() { + return onrenderInstance(this, css); + }, + teardown() { + return removeInstance(this, css); + } + }); + }; + const onConstruct = function(componentConfig) { + const sourceConstruct = componentConfig.onconstruct; + componentConfig.onconstruct = function(...args) { + apply$2(buildComponentEvents, this, [componentConfig, ...args]); + if (sourceConstruct) { + return apply$2(sourceConstruct, this, args); + } + }; + const sourceRender = componentConfig.onrender; + componentConfig.onrender = function(...args) { + if (sourceRender) { + return apply$2(sourceRender, this, args); + } + }; + }; + const { + utility: { + cnsl: cnsl$1, assign: assign$2 + } + } = app; + cnsl$1('viewSetup Module', 'notify'); + const initializeComponent = (componentConfig) => { + componentConfig.decorators = assign$2(componentConfig.decorators || {}, {}); + const { + css, model: componentModel, asset, name: componentName + } = componentConfig; + registerCssComponent(css, componentConfig); + if (asset && (componentName || componentModel)) { + importTemplate(componentName, componentModel, asset); + importPartials(componentName, componentModel, asset); + } + onConstruct(componentConfig); + }; + const { + utility: { + omit + } + } = app; + const buildComponent = (componentConfig) => { + initializeComponent(componentConfig); + const { + name: componentName, model + } = componentConfig; + const cmpntConfigClean = omit(componentConfig, ['css', 'asset']); + if (componentConfig.CSS) { + cmpntConfigClean.css = componentConfig.CSS; + } + const Component = Ractive.extend(cmpntConfigClean); + if (componentName) { + Ractive.components[componentName] = Component; + } + if (model) { + model.component = Component; + } + return Component; + }; + const { + demand: demand$2, demandCss, demandHtml, + utility: { + assign: assign$1, each: each$2, ensureArray, isString: isString$2 + } + } = app; + const asyncComponent = async function(componentConfig) { + const componentModel = componentConfig.model; + let asset = componentConfig.asset || {}; + if (isString$2(asset)) { + asset = { + css: [`${asset}style`], + template: `${asset}template` + }; + } + componentConfig.asset = asset; + componentConfig.css = componentConfig.css || {}; + componentConfig.partials = componentConfig.partials || {}; + if (asset) { + if (asset.template) { + componentConfig.template = await demandHtml(asset.template); + } + if (asset.demand) { + componentConfig.demand = await demand$2(asset.demand); + } + if (asset.partials) { + assign$1(componentConfig.partials, await demandHtml(asset.partials)); + } + if (asset.css) { + const assetCss = asset.css; + const loadCss = await demandCss(assetCss); + each$2(ensureArray(loadCss), (item, index) => { + let keyName = assetCss[index]; + if (!keyName.includes('.css')) { + keyName = `${keyName}.css`; + } + componentConfig.css[keyName] = item; + }); + } + } + const componentPromise = buildComponent(componentConfig); + if (componentModel) { + componentModel.component = componentPromise; + } + return componentPromise; + }; + const { + utility: { + isString: isString$1 + } + } = app; + const components = {}; + const generateComponent = (ComponentView, config) => { + return new ComponentView(config); + }; + const getComponent = (componentName, config) => { + const componentObject = components[componentName]; + return config ? generateComponent(componentObject, config) : componentObject; + }; + const component$1 = (componentName, componentConfigOption) => { + let method; + const componentConfig = componentConfigOption ? componentConfigOption : componentName; + if (isString$1(componentName)) { + componentConfig.name = componentName; + } + console.log(componentConfig); + if (componentConfig.asset) { + method = asyncComponent; + } else { + method = buildComponent; + } + return method(componentConfig); + }; + app.component = component$1; + app.getComponent = getComponent; + const { + demand: demand$1, + watch, + utility: { + each: each$1, querySelector, isDom + } + } = app; + const onCss = async (json) => { + const filePath = json.name; + const componentName = json.type; + const componentsUsingCss = componentsWithCss[filePath]; + console.log('CSS UPDATE', filePath, componentsUsingCss); + const node = importedCss[filePath] || importedCss[componentName] || querySelector(`[data-src="${filePath}"]`); + if (node || componentsUsingCss) { + const content = await demand$1(filePath); + if (isDom(node)) { + node.innerHTML = content; + } + if (componentsUsingCss) { + each$1(componentsUsingCss, (item) => { + console.log(item); + item.css[filePath] = content; + }); + } + } + }; + watch(/\.css/, onCss); + const { + demand, + utility: { + assign, each, isFunction + } + } = app; + const view = new Ractive({ + data() { + return { + notification: [], + screenSize: '' + }; + }, + template: `{{#@shared.components.main:key}}{{>getComponent(key)}}{{/}}` + }); + view.on({ + async '*.loadComponent'(componentEvent) { + const imported = await demand(componentEvent.get('demand')); + const afterDemand = componentEvent.get('afterDemand'); + if (afterDemand) { + const afterDemandEvents = afterDemand[componentEvent.original.type]; + each(afterDemandEvents, (item, key) => { + if (isFunction(item)) { + item(imported, item, key); + } else { + app.view.findComponent(key).fire(item); + } + }); + } + }, + '*.preventDefault'(context) { + const { + original + } = context; + original.preventDefault(); + original.stopPropagation(); + } + }); + app.importComponent = async (componentName, importURL, type = 'dynamic') => { + if (importURL) { + await demand(importURL); + } + await view.set(`@shared.components.${type}.${componentName}`, true); + await view.update('@shared.components.${type}'); + }; + app.title = new Ractive({ + target: 'head', + append: true, + data() { + return {}; + }, + template: `{{@shared.pageTitle}}` + }); + assign(app, { + async render() { + await Ractive.sharedSet('components', { + dynamic: {}, + layout: {}, + main: {} + }); + await app.initializeScreen(); + await view.render('body'); + }, + view + }); + localStorage.clear(); + const { demandJs, - demandLang + utility: { + cnsl, assignDeep, mapArray, map, isString, rest, camelCase, eventAdd, apply: apply$1, isRegExp, mapWhile, ifInvoke, hasValue, last + }, + component + } = app; + cnsl('ROUTER ONLINE', 'important'); + class Router { + constructor() { + return this; + } + debug = false; + hostname = location.hostname; + pathname = location.pathname; + navHistory = []; + historyIndex = 0; + routes = []; + methods = {}; + defaults = { + protected: false, + role: false + }; + state; + log(...args) { + if (this.debug || app.debug) { + apply$1(console.log, console, args); + } + } + popstate(popstateEvent) { + app.router.log('popstate', popstateEvent); + popstateEvent.preventDefault(); + app.router.process(); + } + pushState(url) { + history.pushState({}, url, url); + app.router.process(); + } + installRoute(routeModel) { + app.router.log('Install Route', routeModel); + const { + match + } = routeModel; + if (match) { + routeModel.regex = isRegExp(match) ? match : new RegExp(match); + } + return app.router.routes.push(routeModel); + } + add(item) { + this.log('add routes', item); + return mapArray(item, this.installRoute); + } + async setup(options) { + this.log('setup router'); + this.add(options.routes); + this.log('assign options'); + assignDeep(this, options); + this.log('eventAdd popstate'); + eventAdd(window, 'popstate', this.popstate, true); + await this.process(); + } + async updateLocation() { + map(location, (item, index) => { + if (isString(item)) { + this[index] = item; + } + }); + this.pathScored = this.pathname.replace(/\//g, '_'); + this.paths = rest(this.pathname.split('/')); + this.pathCamel = camelCase(this.paths.join('_')); + this.navHistory.push(this.pathname); + this.historyIndex++; + } + async compilePath() { + const { + route, secured, role, path + } = this.pathState; + this.log(this.pathState); + if (route) { + this.pathState.path = route(); + } else if (!path) { + this.pathState.path = this.pathname; + } + if (last(this.pathState.path) !== '/') { + this.pathState.path = `${this.pathState.path}/`; + } + if (this.pathState.path[0] !== '/') { + this.pathState.path = `/${this.pathState.path}`; + } + if (secured) { + const securityCheck = Boolean(await this.methods.security(this.match)); + if (securityCheck) { + const success = await this.methods.success(); + if (role) { + this.pathState.path = `${path}${success}/`; + } + } else { + this.pathState.path = `/${await this.methods.fail()}/`; + } + } + this.pathState.path = `/${this.defaults.root}${this.pathState.path}index`; + } + checkMatch(routeObject) { + const check = routeObject.regex.test(app.router.pathname); + if (check) { + app.router.routeState = routeObject; + } + app.router.log(check, app.router.pathname, routeObject.regex); + return !check; + } + async close() { + const currentComponent = this.component; + if (currentComponent) { + console.log('Close Component', this, currentComponent); + await app.view.findComponent('navstate').teardown(); + this.component = null; + } + } + async process() { + app.view.fire('router.loading'); + this.log('Router Loading State'); + this.updateLocation(); + this.log(this.routes); + mapWhile(this.routes, this.checkMatch); + const match = app.router.routeState; + this.log('Match found', match); + if (match) { + await this.close(); + const { + path, route + } = match; + const secured = hasValue(match.secured) ? match.secured : this.defaults.secured; + const role = hasValue(match.role) ? match.role : this.defaults.role; + const pathState = { + match, + secured, + role, + path, + route + }; + this.pathState = pathState; + this.match = match; + await this.compilePath(); + await Ractive.sharedSet('@shared.currentPath', this.pathname); + await Ractive.sharedSet('navState', false); + this.log('Checking if Model Loaded', match.model); + if (!match.model) { + if (match.assets) { + if (match.assets.scripts) { + await demandJs(match.assets.scripts); + } + } + this.log('match model', pathState.path); + match.model = await demandJs(pathState.path); + this.log(match.model); + } + this.state = match; + const initializeComponent = await component(match.model.component); + this.log('component made', initializeComponent); + Ractive.components.navstate = initializeComponent; + ifInvoke(match.model.open); + ifInvoke(this.methods.onLoad); + await Ractive.sharedSet('navState', true); + } else { + return false; + } + this.log('Finished processing'); + } + back() { + this.log('Router back State'); + const navHistory = this.navHistory; + if (navHistory.length) { + router.historyIndex--; + window.history.back(); + } + } + forward() { + this.log('Router forward State'); + const navHistory = this.navHistory; + if (navHistory.length > this.historyIndex) { + router.historyIndex++; + window.history.forward(); + } + } + } + app.router = new Router(); + app.view.on({ + '*.routerBack'() { + app.router.back(); + }, + '*.routerForward'() { + app.router.forward(); + }, + '*.route'(componentEvent) { + const { + original, node + } = componentEvent; + const url = componentEvent.get('href') || node.getAttribute('href') || node.getAttribute('data-href'); + original.preventDefault(); + app.router.log(componentEvent, url); + app.router.pushState(url); + return false; + } }); })(); diff --git a/uwBridge/system/compile/build/socket/bundle.js b/uwBridge/system/compile/build/socket/bundle.js deleted file mode 100644 index 1be6c8e2..00000000 --- a/uwBridge/system/compile/build/socket/bundle.js +++ /dev/null @@ -1,1061 +0,0 @@ -(function () { - - (function() { - const app = window.app; - const security = { - clear() { - console.log('Cleanup'); - } - }; - security.clear(); - app.security = security; - const { - utility: { - debounce, eventAdd: eventAdd$1, isAgent, info, model, assign: assign$6 - } - } = app; - app.updateResize = async () => { - await Ractive.sharedSet(info); - const width = info.windowWidth; - let widthLevel = 0; - let screenSize; - if (width < 640) { - screenSize = 'miniScreen'; - } else if (width < 740) { - screenSize = 'tinyScreen'; - widthLevel = 1; - } else if (width < 1024) { - screenSize = 'smallScreen'; - widthLevel = 2; - } else if (width < 1920) { - screenSize = 'mediumScreen'; - widthLevel = 3; - } else if (width < 3000) { - screenSize = 'hdScreen'; - widthLevel = 4; - } else if (width > 3000) { - screenSize = '4kScreen'; - widthLevel = 5; - } - console.log(screenSize); - await Ractive.sharedSet( - assign$6(Ractive.sharedGet(), { - tinyScreen: false, - smallScreen: false, - mediumScreen: false, - hdScreen: false, - '4kScreen': false - }) - ); - await Ractive.sharedSet('screenSize', screenSize); - await Ractive.sharedSet(screenSize, true); - await Ractive.sharedSet('widthLevel', widthLevel); - }; - const updateResize = debounce(app.updateResize, 250); - function calculateScreen() { - requestAnimationFrame(updateResize); - } - eventAdd$1( - window, - 'resize', - () => { - calculateScreen(); - }, - true - ); - const smoothScroll = (element, to, duration) => { - if (duration <= 0) { - return; - } - const difference = to - element.scrollTop; - const perTick = (difference / duration) * 10; - requestAnimationFrame(() => { - element.scrollTop = element.scrollTop + perTick; - if (element.scrollTop === to) { - return; - } - smoothScroll(element, to, duration - 10); - }); - }; - const mobileCheck = () => { - let check = false; - const a = navigator.userAgent || navigator.vendor || window.opera; - if ( - (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i).test( - a - ) || - (/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw(n|u)|c55\/|capi|ccwa|cdm|cell|chtm|cldc|cmd|co(mp|nd)|craw|da(it|ll|ng)|dbte|dcs|devi|dica|dmob|do(c|p)o|ds(12|d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(|_)|g1 u|g560|gene|gf5|gmo|go(\.w|od)|gr(ad|un)|haie|hcit|hd(m|p|t)|hei|hi(pt|ta)|hp( i|ip)|hsc|ht(c(| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i(20|go|ma)|i230|iac( ||\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|[a-w])|libw|lynx|m1w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|mcr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|([1-8]|c))|phil|pire|pl(ay|uc)|pn2|po(ck|rt|se)|prox|psio|ptg|qaa|qc(07|12|21|32|60|[2-7]|i)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h|oo|p)|sdk\/|se(c(|0|1)|47|mc|nd|ri)|sgh|shar|sie(|m)|sk0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h|v|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl|tdg|tel(i|m)|tim|tmo|to(pl|sh)|ts(70|m|m3|m5)|tx9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas|your|zeto|zte/i).test( - a.substr(0, 4) - ) - ) { - check = true; - } - return check; - }; - const tabletCheck = () => { - return (/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/).test( - navigator.userAgent.toLowerCase() - ); - }; - app.initializeScreen = async () => { - const isMobile = mobileCheck(); - const isTablet = tabletCheck(); - if (isMobile) { - await Ractive.sharedSet('classes.mobile', true); - await Ractive.sharedSet('mobile', true); - } - if (isTablet) { - await Ractive.sharedSet('classes.tablet', true); - await Ractive.sharedSet('tablet', true); - } - if (!isMobile && !isTablet) { - await Ractive.sharedSet('classes.desktop', true); - await Ractive.sharedSet('desktop', true); - } - await Ractive.sharedSet('classes.chrome', isAgent.chrome); - await Ractive.sharedSet('classes.android', isAgent.android); - await Ractive.sharedSet('classes.linux', isAgent.linux); - await Ractive.sharedSet('classes.mozilla', isAgent.mozilla); - await Ractive.sharedSet('classes.applewebkit', isAgent.applewebkit); - await app.updateResize(); - }; - model('smoothScroll', smoothScroll); - window.Ractive.prototype.data = { - $: app.utility, - getComponent(partialName) { - const componentName = partialName; - const partial = `<${partialName} />`; - console.log(componentName); - const partialsCheck = Boolean(this.partials[partialName]); - if (!partialsCheck) { - this.partials[partialName] = partial; - } - return partialName; - }, - makePartial(id, template) { - const key = `partial-${id}`; - const partialsCheck = Boolean(this.partials[id]); - if (partialsCheck) { - return key; - } - this.partials[key] = template; - return key; - } - }; - const { - utility: { - findIndex, - hasValue, - get: get$1, - isPlainObject, - findItem, - assignDeep, - ensureArray: ensureArray$1, - assign: assign$5, - each: each$9, - isArray: isArray$1, - isEmpty, - sortNewest, - sortOldest, - clear - } - } = app; - const extendRactive = { - async afterIndex(path, indexMatch, item, indexName) { - const index = findIndex(this.get(path), indexMatch, indexName); - if (hasValue(index)) { - await this.splice(path, index + 1, 0, ...ensureArray$1(item)); - } else { - await this.push(path, item); - } - }, - async assign(path, mergeObject) { - const item = this.get(path); - if (hasValue(item)) { - assignDeep(item, mergeObject); - await this.update(path); - return item; - } - }, - async beforeIndex(path, indexMatch, item, indexName) { - const index = findIndex(this.get(path), indexMatch, indexName); - if (hasValue(index)) { - await this.splice(path, index - 1, 0, ...ensureArray$1(item)); - } else { - await this.push(path, item); - } - }, - async clearArray(path) { - const arrayToClear = this.get(path); - if (arrayToClear) { - clear(arrayToClear); - await this.update(path); - } - }, - findItem(path, indexMatch, indexName) { - const item = find(this.get(path), indexMatch, indexName); - if (hasValue(item)) { - return item; - } - }, - getIndex(path, indexMatch, indexName) { - const index = findIndex(this.get(path), indexMatch, indexName); - if (hasValue(index)) { - return index; - } - }, - async mergeItem(path, indexMatch, newVal, indexName) { - const item = findItem(this.get(path), indexMatch, indexName); - if (hasValue(item)) { - assignDeep(item, newVal); - await this.update(path); - return item; - } - }, - async removeIndex(path, indexMatch, indexName) { - const index = findIndex(this.get(path), indexMatch, indexName); - if (hasValue(index)) { - await this.splice(path, index, 1); - } - }, - async setIndex(path, indexMatch, item, indexName, optionsArg) { - const options = optionsArg || {}; - const index = findIndex(this.get(path), indexMatch, indexName); - if (hasValue(index)) { - const pathSuffix = options.pathSuffix ? `.${options.pathSuffix}` : ''; - await this.set(`${path}.${index}${pathSuffix}`, item); - } else if (get$1('conflict', options) === 'insert') { - await this[get$1('conflictMethod', options) || 'push'](path, item); - } - }, - async sortNewest(path, property) { - const array = this.get(path); - sortNewest(array, property, true); - await this.update(path); - }, - async sortOldest(path, property) { - const array = this.get(path); - sortOldest(array, property, true); - await this.update(path); - }, - async syncCollection(path, newValArg, type = 'push', indexName = 'id') { - const oldVal = this.get(path); - if (isPlainObject(oldVal)) { - assignDeep(oldVal, newValArg); - } else { - const newVal = ensureArray$1(newValArg); - each$9(newVal, (item) => { - const oldValItem = findItem(oldVal, item[indexName], indexName); - if (hasValue(oldValItem)) { - assign$5(oldValItem, item); - } else { - oldVal[type](item); - } - }); - } - await this.update(path); - }, - async toggleIndex(path, indexMatchArg, pathSuffixArg, indexName) { - let indexMatch; - const arrayCheck = isArray$1(indexMatchArg); - if (arrayCheck && !isEmpty(indexMatchArg)) { - indexMatch = indexMatchArg.shift(); - } else { - indexMatch = indexMatchArg; - } - const index = findIndex(this.get(path), indexMatch, indexName); - if (hasValue(index)) { - const pathSuffix = pathSuffixArg ? `.${pathSuffixArg}` : ''; - await this.toggle(`${path}.${index}${pathSuffix}`); - } - if (arrayCheck && !isEmpty(indexMatchArg)) { - await this.toggleIndex(path, indexMatchArg, pathSuffixArg, indexName); - } - }, - async updateItem(path, indexMatch, react, indexName) { - const item = findItem(this.get(path), indexMatch, indexName); - if (hasValue(item)) { - react(item); - await this.update(path); - return item; - } - } - }; - assign$5(Ractive.prototype, extendRactive); - const getComponentName = (componentModel, componentName) => { - return componentModel === app.router.currentStateObject ? 'navState' : componentName; - }; - const { - watch: watch$2, - demand: demand$3, - utility: { - each: each$8, isFunction: isFunction$1 - }, - crate - } = app; - const onHtml = async (matchFilename, componentName, json) => { - const type = json.type; - const filePath = json.name; - if (app.debug) { - console.log('WATCH HTML', matchFilename, json); - } - if (!filePath.includes(matchFilename)) { - return; - } - const html = await demand$3(filePath); - crate.setItem(filePath, html); - if (app.debug) { - console.log(type, filePath, html); - } - if (isFunction$1(componentName)) { - componentName(html); - } else { - each$8(app.view.findAllComponents(componentName), (item) => { - if (app.debug) { - console.log(item); - } - item.resetTemplate(html); - }); - } - window.UIkit.update(document.body, 'update'); - }; - const watchHtml = (matchFilename, componentName) => { - if (app.debug) { - console.log('WATCH HTML', matchFilename); - } - return watch$2(matchFilename, (json) => { - onHtml(matchFilename, componentName, json); - }); - }; - watch$2.html = watchHtml; - const { - utility: { - each: each$7 - } - } = app; - const importPartials = (componentName, componentModel, asset) => { - if (asset.partials) { - each$7(asset.partials, (item, key) => { - watchHtml(item.includes('.html') ? item : `${item}.html`, (html) => { - const realName = getComponentName(componentModel, componentName); - each$7(app.view.findAllComponents(realName), (subItem) => { - subItem.resetPartial(key, html); - }); - }); - }); - } - }; - const importTemplate = (componentName, componentModel, asset) => { - let template = asset.template; - if (!template.includes('.html') && !template.includes('.hbs') && !template.includes('.mustache')) { - template = asset.template = asset.template = `${template}.html`; - } - if (template) { - watchHtml(template, (html) => { - const realName = getComponentName(componentModel, componentName); - if (realName) { - const matchedComponent = app.view.findComponent(realName); - if (matchedComponent) { - matchedComponent.resetTemplate(html); - } - } - }); - } - }; - const { - utility: { - each: each$6, isString: isString$3, isArray, apply: apply$2 - } - } = app; - const logMulti = console; - function debugMultiEvent(...args) { - if (app.debug || app.debugMultiEvent) { - apply$2(logMulti.log, logMulti, args); - } - } - const multiEvent = (currentView, componentEvent, events, ...args) => { - debugMultiEvent(currentView, componentEvent, events); - debugMultiEvent(args); - if (componentEvent && events.length) { - const { - original - } = componentEvent; - original.preventDefault(); - original.stopPropagation(); - } - if (events) { - if (isString$3(events)) { - each$6(events.split(','), (subItem) => { - if (subItem) { - currentView.fire(subItem.trim(), componentEvent, ...args); - } - }); - } else if (isArray(events)) { - each$6(events, (item) => { - if (item) { - each$6(item.split(','), (subItem) => { - if (subItem) { - currentView.fire(subItem.trim(), componentEvent, ...args); - } - }); - } - }); - } - } - }; - const { - utility: { - each: each$5, assign: assign$4, querySelector: querySelector$1 - } - } = app; - const headNode = querySelector$1('head'); - const importedCssCount = {}; - const importedCss = {}; - const render = (code, filePath) => { - if (importedCss[filePath]) { - importedCssCount[filePath]++; - } else { - importedCssCount[filePath] = 0; - const node = document.createElement('style'); - node.innerHTML = code; - node.setAttribute('data-src', filePath); - headNode.appendChild(node); - importedCss[filePath] = node; - } - }; - const unrender = (code, filePath) => { - if (importedCss[filePath]) { - importedCssCount[filePath]--; - if (importedCssCount[filePath] < 0) { - importedCss[filePath].remove(); - importedCss[filePath] = null; - importedCssCount[filePath] = null; - } - } - }; - const cssRender = (css) => { - if (css) { - each$5(css, render); - } - }; - const cssUnrender = (css) => { - if (css) { - each$5(css, unrender); - } - }; - const componentsWithCss = {}; - const registerCssComponent = (css, componentConfig) => { - if (!css) { - return; - } - each$5(css, (item, key) => { - if (!componentsWithCss[key]) { - componentsWithCss[key] = []; - } - componentsWithCss[key].push(componentConfig); - }); - }; - assign$4(app, { - componentsWithCss, - importedCss, - importedCssCount - }); - const { - watch: watch$1, - utility: { - each: each$4, get, apply: apply$1 - } - } = app; - const createWatchers = (currentView, item, key) => { - if (get('isWatcher', item._)) { - currentView.watchers[key] = item; - return; - } - item.options = item.options || {}; - item.methods = item.methods || {}; - let { - prefix, suffix - } = item.options; - const { - methods - } = item; - const createMethod = methods.create || 'push'; - const readMethod = methods.read || 'push'; - prefix = prefix ? `${prefix}.` : ''; - suffix = suffix ? `.${suffix}` : ''; - item.prefix = prefix; - item.suffix = suffix; - currentView.watchers[key] = watch$1( - { - async create(json) { - await currentView.syncCollection(key, json.item, createMethod); - currentView.fire(`${prefix}create${suffix}`, json.item, json); - }, - async delete(json) { - await currentView.removeIndex(key, json.item.id); - currentView.fire(`${prefix}delete${suffix}`, json.item, json); - }, - async read(json) { - await currentView.syncCollection(key, json.items, readMethod); - currentView.fire(`${prefix}read${suffix}`, json.item, json); - }, - async update(json) { - await currentView.syncCollection(key, json.item, createMethod); - currentView.fire(`${prefix}update${suffix}`, json.item, json); - } - }, - item.options - ); - }; - const removeInstance = function(currentView, css) { - cssUnrender(css); - each$4(currentView.watchers, (item, key) => { - item.stop(); - item[key] = null; - }); - }; - const onrenderInstance = function(currentView, css) { - cssRender(css); - if (currentView.watchers) { - each$4(currentView.watchers, (item) => { - item.start(); - }); - } - }; - const buildComponentEvents = function(componentConfig) { - const { - css, watchers - } = componentConfig; - const thisComponent = this; - thisComponent.watchers = watchers ? watchers(thisComponent) : {}; - if (thisComponent.watchers) { - each$4(thisComponent.watchers, (item, key) => { - createWatchers(thisComponent, item, key); - }); - } - thisComponent.on({ - multi(cmpntEvent, ...args) { - if (app.debug) { - console.log(cmpntEvent, ...args); - } - return multiEvent(this, cmpntEvent, ...args); - }, - render() { - return onrenderInstance(this, css); - }, - teardown() { - return removeInstance(this, css); - } - }); - }; - const onConstruct = function(componentConfig) { - const sourceConstruct = componentConfig.onconstruct; - componentConfig.onconstruct = function(...args) { - apply$1(buildComponentEvents, this, [componentConfig, ...args]); - if (sourceConstruct) { - return apply$1(sourceConstruct, this, args); - } - }; - const sourceRender = componentConfig.onrender; - componentConfig.onrender = function(...args) { - if (sourceRender) { - return apply$1(sourceRender, this, args); - } - }; - }; - const { - utility: { - cnsl: cnsl$1, assign: assign$3 - } - } = app; - cnsl$1('viewSetup Module', 'notify'); - const initializeComponent = (componentConfig) => { - componentConfig.decorators = assign$3(componentConfig.decorators || {}, {}); - const { - css, model: componentModel, asset, name: componentName - } = componentConfig; - registerCssComponent(css, componentConfig); - if (asset && (componentName || componentModel)) { - importTemplate(componentName, componentModel, asset); - importPartials(componentName, componentModel, asset); - } - onConstruct(componentConfig); - }; - const { - utility: { - omit: omit$1 - } - } = app; - const buildComponent = (componentConfig) => { - initializeComponent(componentConfig); - const { - name: componentName, model - } = componentConfig; - const cmpntConfigClean = omit$1(componentConfig, ['css', 'asset']); - if (componentConfig.CSS) { - cmpntConfigClean.css = componentConfig.CSS; - } - const Component = Ractive.extend(cmpntConfigClean); - if (componentName) { - Ractive.components[componentName] = Component; - } - if (model) { - model.component = Component; - } - return Component; - }; - const { - demand: demand$2, - demandCss, - demandHtml, - utility: { - assign: assign$2, each: each$3, ensureArray, isString: isString$2 - } - } = app; - const asyncComponent = async function(componentConfig) { - const componentModel = componentConfig.model; - let asset = componentConfig.asset || {}; - if (isString$2(asset)) { - asset = { - css: [`${asset}style`], - template: `${asset}template` - }; - } - componentConfig.asset = asset; - componentConfig.css = componentConfig.css || {}; - componentConfig.partials = componentConfig.partials || {}; - if (asset) { - if (asset.template) { - componentConfig.template = await demandHtml(asset.template); - } - if (asset.demand) { - componentConfig.demand = await demand$2(asset.demand); - } - if (asset.partials) { - assign$2(componentConfig.partials, await demandHtml(asset.partials)); - } - if (asset.css) { - const assetCss = asset.css; - const loadCss = await demandCss(assetCss); - each$3(ensureArray(loadCss), (item, index) => { - let keyName = assetCss[index]; - if (!keyName.includes('.css')) { - keyName = `${keyName}.css`; - } - componentConfig.css[keyName] = item; - }); - } - } - const componentPromise = buildComponent(componentConfig); - if (componentModel) { - componentModel.component = componentPromise; - } - return componentPromise; - }; - const { - utility: { - isString: isString$1 - } - } = app; - const components = {}; - const generateComponent = (ComponentView, config) => { - return new ComponentView(config); - }; - const getComponent = (componentName, config) => { - const componentObject = components[componentName]; - return config ? generateComponent(componentObject, config) : componentObject; - }; - const component = (componentName, componentConfigOption) => { - let method; - const componentConfig = componentConfigOption ? componentConfigOption : componentName; - if (isString$1(componentName)) { - componentConfig.name = componentName; - } - if (componentConfig.asset) { - method = asyncComponent; - } else { - method = buildComponent; - } - return method(componentConfig); - }; - app.component = component; - app.getComponent = getComponent; - const { - demand: demand$1, - watch, - utility: { - each: each$2, querySelector, isDom - } - } = app; - const onCss = async (json) => { - const filePath = json.name; - const componentName = json.type; - const componentsUsingCss = componentsWithCss[filePath]; - console.log('CSS UPDATE', filePath, componentsUsingCss); - const node = importedCss[filePath] || importedCss[componentName] || querySelector(`[data-src="${filePath}"]`); - if (node || componentsUsingCss) { - const content = await demand$1(filePath); - if (isDom(node)) { - node.innerHTML = content; - } - if (componentsUsingCss) { - each$2(componentsUsingCss, (item) => { - console.log(item); - item.css[filePath] = content; - }); - } - } - }; - watch(/\.css/, onCss); - const { - demand, - utility: { - assign: assign$1, each: each$1, isFunction - } - } = app; - const view = new Ractive({ - data() { - return { - notification: [], - screenSize: '' - }; - }, - template: `{{#@shared.components.main:key}}{{>getComponent(key)}}{{/}}` - }); - view.on({ - async '*.loadComponent'(componentEvent) { - const imported = await demand(componentEvent.get('demand')); - const afterDemand = componentEvent.get('afterDemand'); - if (afterDemand) { - const afterDemandEvents = afterDemand[componentEvent.original.type]; - each$1(afterDemandEvents, (item, key) => { - if (isFunction(item)) { - item(imported, item, key); - } else { - app.view.findComponent(key).fire(item); - } - }); - } - }, - '*.preventDefault'(context) { - const { - original - } = context; - original.preventDefault(); - original.stopPropagation(); - } - }); - app.importComponent = async (componentName, importURL, type = 'dynamic') => { - if (importURL) { - await demand(importURL); - } - await view.set(`@shared.components.${type}.${componentName}`, true); - await view.update('@shared.components.${type}'); - }; - app.title = new Ractive({ - target: 'head', - append: true, - data() { - return {}; - }, - template: `{{@shared.pageTitle}}` - }); - assign$1(app, { - async render() { - await Ractive.sharedSet('components', { - dynamic: {}, - layout: {}, - main: {} - }); - await app.initializeScreen(); - await view.render('body'); - }, - view - }); - const spawnNotification = (data) => {}; - app.notify = async (data) => { - if (Notification.permission === 'granted') { - return spawnNotification(); - } else if (Notification.permission !== 'denied') { - await Notification.requestPermission(); - } - }; - const { - demandJs, - demandLang, - utility: { - cnsl, assign, each, map, isString, rest, camelCase, omit, last, batch, eventAdd, apply - } - } = app; - const router = {}; - const hostname = window.location.hostname; - router.historyIndex = 0; - const logRouter = console; - function debugRouter(...args) { - if (app.debug || app.debugRouter) { - apply(logRouter.log, logRouter, args); - } - } - Ractive.sharedSet('historyIndex', router.historyIndex); - cnsl('ROUTER ONLINE', 'important'); - assign(router, { - add(item) { - each(item, router.addObject); - }, - addObject(item, key) { - const reg = new RegExp(key); - router.routes.push(async () => { - return router.routeChecker(item, reg); - }); - }, - attachEvents() { - eventAdd( - window, - 'popstate', - async (eventArg) => { - debugRouter('popstate', eventArg); - router.saveState(); - router.updateLocation(); - await router.loadState(); - eventArg.preventDefault(); - }, - true - ); - }, - async closeState(previousStateObject) { - debugRouter('closeState', previousStateObject); - if (previousStateObject) { - if (!previousStateObject.closed) { - debugRouter('forceClose', previousStateObject); - return router.forceClose(previousStateObject); - } - return debugRouter('Previous State Marked As Closed', previousStateObject); - } - }, - async forceClose(sourceState) { - app.view.set('navState', false); - debugRouter('forceClose', sourceState); - if (sourceState) { - if (sourceState.watchers) { - sourceState.watchers.stop(); - } - if (sourceState.close) { - debugRouter('MODEL Close STATE', sourceState); - await sourceState.close(); - } - sourceState.closed = true; - } - }, - go(route) { - if (router.analytics) { - router.analytics(); - } - return router.openState(route); - }, - isCurrentModel(modelSafe, success, failure) { - const check = router.currentStateObject ? router.currentStateObject === modelSafe : false; - if (check) { - if (success) { - success(); - } - } else if (failure) { - failure(); - } - return check; - }, - async loadState() { - cnsl('Router Loading State', 'notify'); - const routesLength = router.routes.length; - let index = 0; - while (index < routesLength) { - const item = router.routes[index]; - const result = Boolean(await item()) === false; - index++; - if (result === false) { - debugRouter('LOAD STATE', item, result); - app.view.fire('location.update'); - break; - } - } - }, - location: { - previous: {} - }, - objectRoutes: {}, - async openState(openModel) { - // close event - const previousStateObject = router.currentStateObject; - if (openModel) { - debugRouter('OPENING STATE', openModel); - router.currentStateObject = openModel; - if (previousStateObject === openModel) { - debugRouter('STATE IS SAME MODEL', openModel); - debugRouter('NAVSTATE REFRESH COMPONENT'); - await app.view.set('navState', false); - await app.view.set('navState', true); - return; - } - debugRouter('MODEL CLOSED STATE', openModel.closed); - if (openModel.closed || openModel.closed === undefined) { - debugRouter('MODEL CLOSED', openModel); - openModel.closed = false; - } - if (!openModel.panel) { - await router.closeState(previousStateObject); - } - } else { - debugRouter('CLOSE PREVIOUS PAGE COMPONENT NO CURRENT ONE GIVEN'); - router.currentStateObject = null; - await router.closeState(previousStateObject); - } - debugRouter('CURRENT STATE OBJECT HASH COMPONENT?'); - const currentStateObject = router.currentStateObject; - if (currentStateObject && currentStateObject.component) { - if (currentStateObject.open) { - debugRouter('MODEL OPEN STATE', router.currentStateObject); - currentStateObject.open(); - } - if (app.debug) { - debugRouter('NAVSTATE LOAD NEW COMPONENT'); - } - await Ractive.sharedSet('navState', false); - Ractive.components.navState = currentStateObject.component; - await Ractive.sharedSet('navState', true); - if (currentStateObject.watchers) { - currentStateObject.watchers.start(); - } - return; - } - }, - async pushState(url) { - if (url) { - router.saveState(); - router.setState(url, url); - router.updateLocation(); - await router.loadState(); - } - }, - reloadState(sourceState) { - const currentStateObject = sourceState || router.currentStateObject; - if (currentStateObject) { - if (currentStateObject.reload) { - batch(currentStateObject.reload); - } - } - }, - async routeChecker(data, reg) { - const matching = router.location.pathname.match(reg); - if (matching) { - router.match = matching; - const route = data.route(); - let routePath = last(route.path) === '/' ? route.path : `${route.path}/`; - routePath = routePath[0] === '/' ? routePath : `/${routePath}`; - route.path = routePath; - const routeRequire = data.require; - debugRouter('routeChecker MATCHED', routePath); - if (router.objectRoutes[routePath]) { - await router.go(router.objectRoutes[routePath]); - } else { - (async () => { - debugRouter('routeChecker ASYNC'); - if (!data.loaded && routeRequire) { - debugRouter('routeChecker demandJS'); - await demandJs(routeRequire); - } - const object = await demandJs(`routes${routePath}`); - if (!object) { - return; - } - const lang = await demandLang(routePath); - if (object.component && object.component.then) { - await object.component; - } - object.assets = object.assets || {}; - if (lang) { - object.assets.language = lang; - } - if (object.compile) { - await object.compile(); - } - router.objectRoutes[routePath] = object; - await router.go(object); - data.loaded = true; - })(); - } - } - return matching; - }, - routes: [], - saveState() { - assign(router.location.previous, omit(router.location, ['previous'])); - }, - setState(url, title, object) { - // pushState - if (hostname + url === hostname + window.location.pathname) { - router.reloadState(); - } else { - history.pushState(object, title, url); - } - }, - async setup() { - router.updateLocation(); - router.attachEvents(); - await router.loadState(); - }, - updateLocation() { - map(top.location, (item, index) => { - if (isString(item)) { - router.location[index] = item; - } - }); - router.location.pathScored = router.location.pathname.replace(/\//g, '_'); - router.location.paths = rest(router.location.pathname.split('/')); - router.location.pathCamel = camelCase(router.location.paths.join('_')); - Ractive.sharedSet('currentPath', router.location.pathname); - } - }); - Ractive.routerLoad = (componentView) => { - componentView.on({ - '*.routerBack'(eventArg) { - debugRouter('Router back State', eventArg); - router.historyIndex--; - Ractive.sharedSet('historyIndex', router.historyIndex); - debugRouter(router.historyIndex); - if (router.location.previous.hostname) { - window.history.back(); - } else { - return; - } - }, - '*.routerForward'(eventArg) { - debugRouter('Router forward State', eventArg); - if (router.location.previous.hostname) { - window.history.forward(); - } else { - return; - } - }, - '*.routerLoad'(eventArg) { - const href = eventArg.get('href'); - debugRouter('Router Load State', eventArg.get('href'), eventArg); - router.historyIndex++; - Ractive.sharedSet('historyIndex', router.historyIndex); - debugRouter(router.historyIndex); - if (href) { - router.pushState(href); - } else { - const node = eventArg.node; - const hrefAttribute = node.href || node.getAttribute('data-href'); - eventArg.original.preventDefault(); - router.pushState(hrefAttribute); - } - return false; - } - }); - }; - assign(app, { - router - }); - })(); - -})(); diff --git a/uwBridge/system/compile/build/socket/coreBundle.js b/uwBridge/system/compile/build/socket/coreBundle.js deleted file mode 100644 index 7e77659b..00000000 --- a/uwBridge/system/compile/build/socket/coreBundle.js +++ /dev/null @@ -1,1057 +0,0 @@ -(function() { - const app = window.app; - const security = { - clear() { - console.log('Cleanup'); - } - }; - security.clear(); - app.security = security; - const { - utility: { - debounce, eventAdd: eventAdd$1, isAgent, info, model, assign: assign$6 - } - } = app; - app.updateResize = async () => { - await Ractive.sharedSet(info); - const width = info.windowWidth; - let widthLevel = 0; - let screenSize; - if (width < 640) { - screenSize = 'miniScreen'; - } else if (width < 740) { - screenSize = 'tinyScreen'; - widthLevel = 1; - } else if (width < 1024) { - screenSize = 'smallScreen'; - widthLevel = 2; - } else if (width < 1920) { - screenSize = 'mediumScreen'; - widthLevel = 3; - } else if (width < 3000) { - screenSize = 'hdScreen'; - widthLevel = 4; - } else if (width > 3000) { - screenSize = '4kScreen'; - widthLevel = 5; - } - console.log(screenSize); - await Ractive.sharedSet( - assign$6(Ractive.sharedGet(), { - tinyScreen: false, - smallScreen: false, - mediumScreen: false, - hdScreen: false, - '4kScreen': false - }) - ); - await Ractive.sharedSet('screenSize', screenSize); - await Ractive.sharedSet(screenSize, true); - await Ractive.sharedSet('widthLevel', widthLevel); - }; - const updateResize = debounce(app.updateResize, 250); - function calculateScreen() { - requestAnimationFrame(updateResize); - } - eventAdd$1( - window, - 'resize', - () => { - calculateScreen(); - }, - true - ); - const smoothScroll = (element, to, duration) => { - if (duration <= 0) { - return; - } - const difference = to - element.scrollTop; - const perTick = (difference / duration) * 10; - requestAnimationFrame(() => { - element.scrollTop = element.scrollTop + perTick; - if (element.scrollTop === to) { - return; - } - smoothScroll(element, to, duration - 10); - }); - }; - const mobileCheck = () => { - let check = false; - const a = navigator.userAgent || navigator.vendor || window.opera; - if ( - (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i).test( - a - ) || - (/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw(n|u)|c55\/|capi|ccwa|cdm|cell|chtm|cldc|cmd|co(mp|nd)|craw|da(it|ll|ng)|dbte|dcs|devi|dica|dmob|do(c|p)o|ds(12|d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(|_)|g1 u|g560|gene|gf5|gmo|go(\.w|od)|gr(ad|un)|haie|hcit|hd(m|p|t)|hei|hi(pt|ta)|hp( i|ip)|hsc|ht(c(| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i(20|go|ma)|i230|iac( ||\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|[a-w])|libw|lynx|m1w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|mcr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|([1-8]|c))|phil|pire|pl(ay|uc)|pn2|po(ck|rt|se)|prox|psio|ptg|qaa|qc(07|12|21|32|60|[2-7]|i)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h|oo|p)|sdk\/|se(c(|0|1)|47|mc|nd|ri)|sgh|shar|sie(|m)|sk0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h|v|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl|tdg|tel(i|m)|tim|tmo|to(pl|sh)|ts(70|m|m3|m5)|tx9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas|your|zeto|zte/i).test( - a.substr(0, 4) - ) - ) { - check = true; - } - return check; - }; - const tabletCheck = () => { - return (/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/).test( - navigator.userAgent.toLowerCase() - ); - }; - app.initializeScreen = async () => { - const isMobile = mobileCheck(); - const isTablet = tabletCheck(); - if (isMobile) { - await Ractive.sharedSet('classes.mobile', true); - await Ractive.sharedSet('mobile', true); - } - if (isTablet) { - await Ractive.sharedSet('classes.tablet', true); - await Ractive.sharedSet('tablet', true); - } - if (!isMobile && !isTablet) { - await Ractive.sharedSet('classes.desktop', true); - await Ractive.sharedSet('desktop', true); - } - await Ractive.sharedSet('classes.chrome', isAgent.chrome); - await Ractive.sharedSet('classes.android', isAgent.android); - await Ractive.sharedSet('classes.linux', isAgent.linux); - await Ractive.sharedSet('classes.mozilla', isAgent.mozilla); - await Ractive.sharedSet('classes.applewebkit', isAgent.applewebkit); - await app.updateResize(); - }; - model('smoothScroll', smoothScroll); - window.Ractive.prototype.data = { - $: app.utility, - getComponent(partialName) { - const componentName = partialName; - const partial = `<${partialName} />`; - console.log(componentName); - const partialsCheck = Boolean(this.partials[partialName]); - if (!partialsCheck) { - this.partials[partialName] = partial; - } - return partialName; - }, - makePartial(id, template) { - const key = `partial-${id}`; - const partialsCheck = Boolean(this.partials[id]); - if (partialsCheck) { - return key; - } - this.partials[key] = template; - return key; - } - }; - const { - utility: { - findIndex, - hasValue, - get: get$1, - isPlainObject, - findItem, - assignDeep, - ensureArray: ensureArray$1, - assign: assign$5, - each: each$9, - isArray: isArray$1, - isEmpty, - sortNewest, - sortOldest, - clear - } - } = app; - const extendRactive = { - async afterIndex(path, indexMatch, item, indexName) { - const index = findIndex(this.get(path), indexMatch, indexName); - if (hasValue(index)) { - await this.splice(path, index + 1, 0, ...ensureArray$1(item)); - } else { - await this.push(path, item); - } - }, - async assign(path, mergeObject) { - const item = this.get(path); - if (hasValue(item)) { - assignDeep(item, mergeObject); - await this.update(path); - return item; - } - }, - async beforeIndex(path, indexMatch, item, indexName) { - const index = findIndex(this.get(path), indexMatch, indexName); - if (hasValue(index)) { - await this.splice(path, index - 1, 0, ...ensureArray$1(item)); - } else { - await this.push(path, item); - } - }, - async clearArray(path) { - const arrayToClear = this.get(path); - if (arrayToClear) { - clear(arrayToClear); - await this.update(path); - } - }, - findItem(path, indexMatch, indexName) { - const item = find(this.get(path), indexMatch, indexName); - if (hasValue(item)) { - return item; - } - }, - getIndex(path, indexMatch, indexName) { - const index = findIndex(this.get(path), indexMatch, indexName); - if (hasValue(index)) { - return index; - } - }, - async mergeItem(path, indexMatch, newVal, indexName) { - const item = findItem(this.get(path), indexMatch, indexName); - if (hasValue(item)) { - assignDeep(item, newVal); - await this.update(path); - return item; - } - }, - async removeIndex(path, indexMatch, indexName) { - const index = findIndex(this.get(path), indexMatch, indexName); - if (hasValue(index)) { - await this.splice(path, index, 1); - } - }, - async setIndex(path, indexMatch, item, indexName, optionsArg) { - const options = optionsArg || {}; - const index = findIndex(this.get(path), indexMatch, indexName); - if (hasValue(index)) { - const pathSuffix = options.pathSuffix ? `.${options.pathSuffix}` : ''; - await this.set(`${path}.${index}${pathSuffix}`, item); - } else if (get$1('conflict', options) === 'insert') { - await this[get$1('conflictMethod', options) || 'push'](path, item); - } - }, - async sortNewest(path, property) { - const array = this.get(path); - sortNewest(array, property, true); - await this.update(path); - }, - async sortOldest(path, property) { - const array = this.get(path); - sortOldest(array, property, true); - await this.update(path); - }, - async syncCollection(path, newValArg, type = 'push', indexName = 'id') { - const oldVal = this.get(path); - if (isPlainObject(oldVal)) { - assignDeep(oldVal, newValArg); - } else { - const newVal = ensureArray$1(newValArg); - each$9(newVal, (item) => { - const oldValItem = findItem(oldVal, item[indexName], indexName); - if (hasValue(oldValItem)) { - assign$5(oldValItem, item); - } else { - oldVal[type](item); - } - }); - } - await this.update(path); - }, - async toggleIndex(path, indexMatchArg, pathSuffixArg, indexName) { - let indexMatch; - const arrayCheck = isArray$1(indexMatchArg); - if (arrayCheck && !isEmpty(indexMatchArg)) { - indexMatch = indexMatchArg.shift(); - } else { - indexMatch = indexMatchArg; - } - const index = findIndex(this.get(path), indexMatch, indexName); - if (hasValue(index)) { - const pathSuffix = pathSuffixArg ? `.${pathSuffixArg}` : ''; - await this.toggle(`${path}.${index}${pathSuffix}`); - } - if (arrayCheck && !isEmpty(indexMatchArg)) { - await this.toggleIndex(path, indexMatchArg, pathSuffixArg, indexName); - } - }, - async updateItem(path, indexMatch, react, indexName) { - const item = findItem(this.get(path), indexMatch, indexName); - if (hasValue(item)) { - react(item); - await this.update(path); - return item; - } - } - }; - assign$5(Ractive.prototype, extendRactive); - const getComponentName = (componentModel, componentName) => { - return componentModel === app.router.currentStateObject ? 'navState' : componentName; - }; - const { - watch: watch$2, - demand: demand$3, - utility: { - each: each$8, isFunction: isFunction$1 - }, - crate - } = app; - const onHtml = async (matchFilename, componentName, json) => { - const type = json.type; - const filePath = json.name; - if (app.debug) { - console.log('WATCH HTML', matchFilename, json); - } - if (!filePath.includes(matchFilename)) { - return; - } - const html = await demand$3(filePath); - crate.setItem(filePath, html); - if (app.debug) { - console.log(type, filePath, html); - } - if (isFunction$1(componentName)) { - componentName(html); - } else { - each$8(app.view.findAllComponents(componentName), (item) => { - if (app.debug) { - console.log(item); - } - item.resetTemplate(html); - }); - } - window.UIkit.update(document.body, 'update'); - }; - const watchHtml = (matchFilename, componentName) => { - if (app.debug) { - console.log('WATCH HTML', matchFilename); - } - return watch$2(matchFilename, (json) => { - onHtml(matchFilename, componentName, json); - }); - }; - watch$2.html = watchHtml; - const { - utility: { - each: each$7 - } - } = app; - const importPartials = (componentName, componentModel, asset) => { - if (asset.partials) { - each$7(asset.partials, (item, key) => { - watchHtml(item.includes('.html') ? item : `${item}.html`, (html) => { - const realName = getComponentName(componentModel, componentName); - each$7(app.view.findAllComponents(realName), (subItem) => { - subItem.resetPartial(key, html); - }); - }); - }); - } - }; - const importTemplate = (componentName, componentModel, asset) => { - let template = asset.template; - if (!template.includes('.html') && !template.includes('.hbs') && !template.includes('.mustache')) { - template = asset.template = asset.template = `${template}.html`; - } - if (template) { - watchHtml(template, (html) => { - const realName = getComponentName(componentModel, componentName); - if (realName) { - const matchedComponent = app.view.findComponent(realName); - if (matchedComponent) { - matchedComponent.resetTemplate(html); - } - } - }); - } - }; - const { - utility: { - each: each$6, isString: isString$3, isArray, apply: apply$2 - } - } = app; - const logMulti = console; - function debugMultiEvent(...args) { - if (app.debug || app.debugMultiEvent) { - apply$2(logMulti.log, logMulti, args); - } - } - const multiEvent = (currentView, componentEvent, events, ...args) => { - debugMultiEvent(currentView, componentEvent, events); - debugMultiEvent(args); - if (componentEvent && events.length) { - const { - original - } = componentEvent; - original.preventDefault(); - original.stopPropagation(); - } - if (events) { - if (isString$3(events)) { - each$6(events.split(','), (subItem) => { - if (subItem) { - currentView.fire(subItem.trim(), componentEvent, ...args); - } - }); - } else if (isArray(events)) { - each$6(events, (item) => { - if (item) { - each$6(item.split(','), (subItem) => { - if (subItem) { - currentView.fire(subItem.trim(), componentEvent, ...args); - } - }); - } - }); - } - } - }; - const { - utility: { - each: each$5, assign: assign$4, querySelector: querySelector$1 - } - } = app; - const headNode = querySelector$1('head'); - const importedCssCount = {}; - const importedCss = {}; - const render = (code, filePath) => { - if (importedCss[filePath]) { - importedCssCount[filePath]++; - } else { - importedCssCount[filePath] = 0; - const node = document.createElement('style'); - node.innerHTML = code; - node.setAttribute('data-src', filePath); - headNode.appendChild(node); - importedCss[filePath] = node; - } - }; - const unrender = (code, filePath) => { - if (importedCss[filePath]) { - importedCssCount[filePath]--; - if (importedCssCount[filePath] < 0) { - importedCss[filePath].remove(); - importedCss[filePath] = null; - importedCssCount[filePath] = null; - } - } - }; - const cssRender = (css) => { - if (css) { - each$5(css, render); - } - }; - const cssUnrender = (css) => { - if (css) { - each$5(css, unrender); - } - }; - const componentsWithCss = {}; - const registerCssComponent = (css, componentConfig) => { - if (!css) { - return; - } - each$5(css, (item, key) => { - if (!componentsWithCss[key]) { - componentsWithCss[key] = []; - } - componentsWithCss[key].push(componentConfig); - }); - }; - assign$4(app, { - componentsWithCss, - importedCss, - importedCssCount - }); - const { - watch: watch$1, - utility: { - each: each$4, get, apply: apply$1 - } - } = app; - const createWatchers = (currentView, item, key) => { - if (get('isWatcher', item._)) { - currentView.watchers[key] = item; - return; - } - item.options = item.options || {}; - item.methods = item.methods || {}; - let { - prefix, suffix - } = item.options; - const { - methods - } = item; - const createMethod = methods.create || 'push'; - const readMethod = methods.read || 'push'; - prefix = prefix ? `${prefix}.` : ''; - suffix = suffix ? `.${suffix}` : ''; - item.prefix = prefix; - item.suffix = suffix; - currentView.watchers[key] = watch$1( - { - async create(json) { - await currentView.syncCollection(key, json.item, createMethod); - currentView.fire(`${prefix}create${suffix}`, json.item, json); - }, - async delete(json) { - await currentView.removeIndex(key, json.item.id); - currentView.fire(`${prefix}delete${suffix}`, json.item, json); - }, - async read(json) { - await currentView.syncCollection(key, json.items, readMethod); - currentView.fire(`${prefix}read${suffix}`, json.item, json); - }, - async update(json) { - await currentView.syncCollection(key, json.item, createMethod); - currentView.fire(`${prefix}update${suffix}`, json.item, json); - } - }, - item.options - ); - }; - const removeInstance = function(currentView, css) { - cssUnrender(css); - each$4(currentView.watchers, (item, key) => { - item.stop(); - item[key] = null; - }); - }; - const onrenderInstance = function(currentView, css) { - cssRender(css); - if (currentView.watchers) { - each$4(currentView.watchers, (item) => { - item.start(); - }); - } - }; - const buildComponentEvents = function(componentConfig) { - const { - css, watchers - } = componentConfig; - const thisComponent = this; - thisComponent.watchers = watchers ? watchers(thisComponent) : {}; - if (thisComponent.watchers) { - each$4(thisComponent.watchers, (item, key) => { - createWatchers(thisComponent, item, key); - }); - } - thisComponent.on({ - multi(cmpntEvent, ...args) { - if (app.debug) { - console.log(cmpntEvent, ...args); - } - return multiEvent(this, cmpntEvent, ...args); - }, - render() { - return onrenderInstance(this, css); - }, - teardown() { - return removeInstance(this, css); - } - }); - }; - const onConstruct = function(componentConfig) { - const sourceConstruct = componentConfig.onconstruct; - componentConfig.onconstruct = function(...args) { - apply$1(buildComponentEvents, this, [componentConfig, ...args]); - if (sourceConstruct) { - return apply$1(sourceConstruct, this, args); - } - }; - const sourceRender = componentConfig.onrender; - componentConfig.onrender = function(...args) { - if (sourceRender) { - return apply$1(sourceRender, this, args); - } - }; - }; - const { - utility: { - cnsl: cnsl$1, assign: assign$3 - } - } = app; - cnsl$1('viewSetup Module', 'notify'); - const initializeComponent = (componentConfig) => { - componentConfig.decorators = assign$3(componentConfig.decorators || {}, {}); - const { - css, model: componentModel, asset, name: componentName - } = componentConfig; - registerCssComponent(css, componentConfig); - if (asset && (componentName || componentModel)) { - importTemplate(componentName, componentModel, asset); - importPartials(componentName, componentModel, asset); - } - onConstruct(componentConfig); - }; - const { - utility: { - omit: omit$1 - } - } = app; - const buildComponent = (componentConfig) => { - initializeComponent(componentConfig); - const { - name: componentName, model - } = componentConfig; - const cmpntConfigClean = omit$1(componentConfig, ['css', 'asset']); - if (componentConfig.CSS) { - cmpntConfigClean.css = componentConfig.CSS; - } - const Component = Ractive.extend(cmpntConfigClean); - if (componentName) { - Ractive.components[componentName] = Component; - } - if (model) { - model.component = Component; - } - return Component; - }; - const { - demand: demand$2, - demandCss, - demandHtml, - utility: { - assign: assign$2, each: each$3, ensureArray, isString: isString$2 - } - } = app; - const asyncComponent = async function(componentConfig) { - const componentModel = componentConfig.model; - let asset = componentConfig.asset || {}; - if (isString$2(asset)) { - asset = { - css: [`${asset}style`], - template: `${asset}template` - }; - } - componentConfig.asset = asset; - componentConfig.css = componentConfig.css || {}; - componentConfig.partials = componentConfig.partials || {}; - if (asset) { - if (asset.template) { - componentConfig.template = await demandHtml(asset.template); - } - if (asset.demand) { - componentConfig.demand = await demand$2(asset.demand); - } - if (asset.partials) { - assign$2(componentConfig.partials, await demandHtml(asset.partials)); - } - if (asset.css) { - const assetCss = asset.css; - const loadCss = await demandCss(assetCss); - each$3(ensureArray(loadCss), (item, index) => { - let keyName = assetCss[index]; - if (!keyName.includes('.css')) { - keyName = `${keyName}.css`; - } - componentConfig.css[keyName] = item; - }); - } - } - const componentPromise = buildComponent(componentConfig); - if (componentModel) { - componentModel.component = componentPromise; - } - return componentPromise; - }; - const { - utility: { - isString: isString$1 - } - } = app; - const components = {}; - const generateComponent = (ComponentView, config) => { - return new ComponentView(config); - }; - const getComponent = (componentName, config) => { - const componentObject = components[componentName]; - return config ? generateComponent(componentObject, config) : componentObject; - }; - const component = (componentName, componentConfigOption) => { - let method; - const componentConfig = componentConfigOption ? componentConfigOption : componentName; - if (isString$1(componentName)) { - componentConfig.name = componentName; - } - if (componentConfig.asset) { - method = asyncComponent; - } else { - method = buildComponent; - } - return method(componentConfig); - }; - app.component = component; - app.getComponent = getComponent; - const { - demand: demand$1, - watch, - utility: { - each: each$2, querySelector, isDom - } - } = app; - const onCss = async (json) => { - const filePath = json.name; - const componentName = json.type; - const componentsUsingCss = componentsWithCss[filePath]; - console.log('CSS UPDATE', filePath, componentsUsingCss); - const node = importedCss[filePath] || importedCss[componentName] || querySelector(`[data-src="${filePath}"]`); - if (node || componentsUsingCss) { - const content = await demand$1(filePath); - if (isDom(node)) { - node.innerHTML = content; - } - if (componentsUsingCss) { - each$2(componentsUsingCss, (item) => { - console.log(item); - item.css[filePath] = content; - }); - } - } - }; - watch(/\.css/, onCss); - const { - demand, - utility: { - assign: assign$1, each: each$1, isFunction - } - } = app; - const view = new Ractive({ - data() { - return { - notification: [], - screenSize: '' - }; - }, - template: `{{#@shared.components.main:key}}{{>getComponent(key)}}{{/}}` - }); - view.on({ - async '*.loadComponent'(componentEvent) { - const imported = await demand(componentEvent.get('demand')); - const afterDemand = componentEvent.get('afterDemand'); - if (afterDemand) { - const afterDemandEvents = afterDemand[componentEvent.original.type]; - each$1(afterDemandEvents, (item, key) => { - if (isFunction(item)) { - item(imported, item, key); - } else { - app.view.findComponent(key).fire(item); - } - }); - } - }, - '*.preventDefault'(context) { - const { - original - } = context; - original.preventDefault(); - original.stopPropagation(); - } - }); - app.importComponent = async (componentName, importURL, type = 'dynamic') => { - if (importURL) { - await demand(importURL); - } - await view.set(`@shared.components.${type}.${componentName}`, true); - await view.update('@shared.components.${type}'); - }; - app.title = new Ractive({ - target: 'head', - append: true, - data() { - return {}; - }, - template: `{{@shared.pageTitle}}` - }); - assign$1(app, { - async render() { - await Ractive.sharedSet('components', { - dynamic: {}, - layout: {}, - main: {} - }); - await app.initializeScreen(); - await view.render('body'); - }, - view - }); - const spawnNotification = (data) => {}; - app.notify = async (data) => { - if (Notification.permission === 'granted') { - return spawnNotification(); - } else if (Notification.permission !== 'denied') { - await Notification.requestPermission(); - } - }; - const { - demandJs, - demandLang, - utility: { - cnsl, assign, each, map, isString, rest, camelCase, omit, last, batch, eventAdd, apply - } - } = app; - const router = {}; - const hostname = window.location.hostname; - router.historyIndex = 0; - const logRouter = console; - function debugRouter(...args) { - if (app.debug || app.debugRouter) { - apply(logRouter.log, logRouter, args); - } - } - Ractive.sharedSet('historyIndex', router.historyIndex); - cnsl('ROUTER ONLINE', 'important'); - assign(router, { - add(item) { - each(item, router.addObject); - }, - addObject(item, key) { - const reg = new RegExp(key); - router.routes.push(async () => { - return router.routeChecker(item, reg); - }); - }, - attachEvents() { - eventAdd( - window, - 'popstate', - async (eventArg) => { - debugRouter('popstate', eventArg); - router.saveState(); - router.updateLocation(); - await router.loadState(); - eventArg.preventDefault(); - }, - true - ); - }, - async closeState(previousStateObject) { - debugRouter('closeState', previousStateObject); - if (previousStateObject) { - if (!previousStateObject.closed) { - debugRouter('forceClose', previousStateObject); - return router.forceClose(previousStateObject); - } - return debugRouter('Previous State Marked As Closed', previousStateObject); - } - }, - async forceClose(sourceState) { - app.view.set('navState', false); - debugRouter('forceClose', sourceState); - if (sourceState) { - if (sourceState.watchers) { - sourceState.watchers.stop(); - } - if (sourceState.close) { - debugRouter('MODEL Close STATE', sourceState); - await sourceState.close(); - } - sourceState.closed = true; - } - }, - go(route) { - if (router.analytics) { - router.analytics(); - } - return router.openState(route); - }, - isCurrentModel(modelSafe, success, failure) { - const check = router.currentStateObject ? router.currentStateObject === modelSafe : false; - if (check) { - if (success) { - success(); - } - } else if (failure) { - failure(); - } - return check; - }, - async loadState() { - cnsl('Router Loading State', 'notify'); - const routesLength = router.routes.length; - let index = 0; - while (index < routesLength) { - const item = router.routes[index]; - const result = Boolean(await item()) === false; - index++; - if (result === false) { - debugRouter('LOAD STATE', item, result); - app.view.fire('location.update'); - break; - } - } - }, - location: { - previous: {} - }, - objectRoutes: {}, - async openState(openModel) { - // close event - const previousStateObject = router.currentStateObject; - if (openModel) { - debugRouter('OPENING STATE', openModel); - router.currentStateObject = openModel; - if (previousStateObject === openModel) { - debugRouter('STATE IS SAME MODEL', openModel); - debugRouter('NAVSTATE REFRESH COMPONENT'); - await app.view.set('navState', false); - await app.view.set('navState', true); - return; - } - debugRouter('MODEL CLOSED STATE', openModel.closed); - if (openModel.closed || openModel.closed === undefined) { - debugRouter('MODEL CLOSED', openModel); - openModel.closed = false; - } - if (!openModel.panel) { - await router.closeState(previousStateObject); - } - } else { - debugRouter('CLOSE PREVIOUS PAGE COMPONENT NO CURRENT ONE GIVEN'); - router.currentStateObject = null; - await router.closeState(previousStateObject); - } - debugRouter('CURRENT STATE OBJECT HASH COMPONENT?'); - const currentStateObject = router.currentStateObject; - if (currentStateObject && currentStateObject.component) { - if (currentStateObject.open) { - debugRouter('MODEL OPEN STATE', router.currentStateObject); - currentStateObject.open(); - } - if (app.debug) { - debugRouter('NAVSTATE LOAD NEW COMPONENT'); - } - await Ractive.sharedSet('navState', false); - Ractive.components.navState = currentStateObject.component; - await Ractive.sharedSet('navState', true); - if (currentStateObject.watchers) { - currentStateObject.watchers.start(); - } - return; - } - }, - async pushState(url) { - if (url) { - router.saveState(); - router.setState(url, url); - router.updateLocation(); - await router.loadState(); - } - }, - reloadState(sourceState) { - const currentStateObject = sourceState || router.currentStateObject; - if (currentStateObject) { - if (currentStateObject.reload) { - batch(currentStateObject.reload); - } - } - }, - async routeChecker(data, reg) { - const matching = router.location.pathname.match(reg); - if (matching) { - router.match = matching; - const route = data.route(); - let routePath = last(route.path) === '/' ? route.path : `${route.path}/`; - routePath = routePath[0] === '/' ? routePath : `/${routePath}`; - route.path = routePath; - const routeRequire = data.require; - debugRouter('routeChecker MATCHED', routePath); - if (router.objectRoutes[routePath]) { - await router.go(router.objectRoutes[routePath]); - } else { - (async () => { - debugRouter('routeChecker ASYNC'); - if (!data.loaded && routeRequire) { - debugRouter('routeChecker demandJS'); - await demandJs(routeRequire); - } - const object = await demandJs(`routes${routePath}`); - if (!object) { - return; - } - const lang = await demandLang(routePath); - if (object.component && object.component.then) { - await object.component; - } - object.assets = object.assets || {}; - if (lang) { - object.assets.language = lang; - } - if (object.compile) { - await object.compile(); - } - router.objectRoutes[routePath] = object; - await router.go(object); - data.loaded = true; - })(); - } - } - return matching; - }, - routes: [], - saveState() { - assign(router.location.previous, omit(router.location, ['previous'])); - }, - setState(url, title, object) { - // pushState - if (hostname + url === hostname + window.location.pathname) { - router.reloadState(); - } else { - history.pushState(object, title, url); - } - }, - async setup() { - router.updateLocation(); - router.attachEvents(); - await router.loadState(); - }, - updateLocation() { - map(top.location, (item, index) => { - if (isString(item)) { - router.location[index] = item; - } - }); - router.location.pathScored = router.location.pathname.replace(/\//g, '_'); - router.location.paths = rest(router.location.pathname.split('/')); - router.location.pathCamel = camelCase(router.location.paths.join('_')); - Ractive.sharedSet('currentPath', router.location.pathname); - } - }); - Ractive.routerLoad = (componentView) => { - componentView.on({ - '*.routerBack'(eventArg) { - debugRouter('Router back State', eventArg); - router.historyIndex--; - Ractive.sharedSet('historyIndex', router.historyIndex); - debugRouter(router.historyIndex); - if (router.location.previous.hostname) { - window.history.back(); - } else { - return; - } - }, - '*.routerForward'(eventArg) { - debugRouter('Router forward State', eventArg); - if (router.location.previous.hostname) { - window.history.forward(); - } else { - return; - } - }, - '*.routerLoad'(eventArg) { - const href = eventArg.get('href'); - debugRouter('Router Load State', eventArg.get('href'), eventArg); - router.historyIndex++; - Ractive.sharedSet('historyIndex', router.historyIndex); - debugRouter(router.historyIndex); - if (href) { - router.pushState(href); - } else { - const node = eventArg.node; - const hrefAttribute = node.href || node.getAttribute('data-href'); - eventArg.original.preventDefault(); - router.pushState(hrefAttribute); - } - return false; - } - }); - }; - assign(app, { - router - }); -})(); diff --git a/uwBridge/system/compile/build/socket/coreBundle.js.map b/uwBridge/system/compile/build/socket/coreBundle.js.map deleted file mode 100644 index b1dcf536..00000000 --- a/uwBridge/system/compile/build/socket/coreBundle.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"coreBundle.js","sources":["../../source/socket/app.js","../../source/socket/security/index.js","../../source/socket/events/resize.js","../../source/socket/component/defaultData.js","../../source/socket/component/extendRactive.js","../../source/socket/component/getComponentName.js","../../source/socket/component/watch/html.js","../../source/socket/component/importPartials.js","../../source/socket/component/importTemplate.js","../../source/socket/component/multiEvent.js","../../source/socket/component/preventDefault.js","../../source/socket/component/css.js","../../source/socket/component/onConstruct.js","../../source/socket/component/initializeComponent.js","../../source/socket/component/buildComponent.js","../../source/socket/component/asyncComponent.js","../../source/socket/component/component.js","../../source/socket/component/watch/css.js","../../source/socket/component/view.js","../../source/socket/notifications/index.js","../../source/socket/router/setup.js"],"sourcesContent":["const app = window.app;\nexport default app;\n","import app from '../app';\nconst security = {\n clear() {\n console.log('Cleanup');\n }\n};\nsecurity.clear();\napp.security = security;\n","import app from '../app';\nconst {\n utility: {\n debounce,\n eventAdd,\n isAgent,\n info,\n model\n },\n view\n} = app;\nconst updateResize = debounce(() => {\n app.view.set('bodyHeight', info.bodyHeight);\n app.view.set('bodyWidth', info.bodyWidth);\n app.view.set('windowHeight', info.windowHeight);\n app.view.set('windowWidth', info.windowWidth);\n const width = info.windowWidth;\n let screenSize;\n if (isAgent.mobile) {\n screenSize = 'mobileScreen';\n } else if (width < 1024) {\n screenSize = 'smallScreen';\n } else if (width < 1920) {\n screenSize = 'mediumScreen';\n } else if (width < 3000) {\n screenSize = 'hdScreen';\n } else if (width > 3000) {\n screenSize = '4kScreen';\n }\n console.log(screenSize);\n app.view.set('screenSize', screenSize);\n}, 250);\neventAdd(window, 'resize', () => {\n requestAnimationFrame(updateResize);\n}, true);\nupdateResize();\nconst smoothScroll = (element, to, duration) => {\n if (duration <= 0) {\n return;\n }\n const difference = to - element.scrollTop;\n const perTick = difference / duration * 10;\n requestAnimationFrame(() => {\n element.scrollTop = element.scrollTop + perTick;\n if (element.scrollTop === to) {\n return;\n }\n smoothScroll(element, to, duration - 10);\n });\n};\nmodel('smoothScroll', smoothScroll);\n","import app from '../app';\nwindow.Ractive.prototype.data = {\n $: app.utility,\n getComponent(partialName) {\n const componentName = partialName;\n const partial = `<${partialName} />`;\n console.log(componentName);\n const partialsCheck = Boolean(this.partials[partialName]);\n if (!partialsCheck) {\n this.partials[partialName] = partial;\n }\n return partialName;\n },\n makePartial(id, template) {\n const key = `partial-${id}`;\n const partialsCheck = Boolean(this.partials[id]);\n if (partialsCheck) {\n return key;\n }\n this.partials[key] = template;\n return key;\n },\n};\n","import app from '../app';\nconst {\n componentMethods,\n utility: {\n findIndex,\n hasValue,\n get,\n isPlainObject,\n findItem,\n assignDeep,\n ensureArray,\n assign,\n each,\n isArray,\n isEmpty,\n sortNewest,\n sortOldest,\n clear,\n }\n} = app;\nexport const extendRactive = {\n async afterIndex(componentView, path, indexMatch, item, indexName) {\n const index = findIndex(componentView.get(path), indexMatch, indexName);\n if (hasValue(index)) {\n await componentView.splice(path, index + 1, 0, ...ensureArray(item));\n } else {\n await componentView.push(path, item);\n }\n },\n async assign(componentView, path, mergeObject) {\n const item = componentView.get(path);\n if (hasValue(item)) {\n assignDeep(item, mergeObject);\n await componentView.update(path);\n return item;\n }\n },\n async beforeIndex(componentView, path, indexMatch, item, indexName) {\n const index = findIndex(componentView.get(path), indexMatch, indexName);\n if (hasValue(index)) {\n await componentView.splice(path, index - 1, 0, ...ensureArray(item));\n } else {\n await componentView.push(path, item);\n }\n },\n async clearArray(componentView, path) {\n const arrayToClear = componentView.get(path);\n if (arrayToClear) {\n clear(arrayToClear);\n await componentView.update(path);\n }\n },\n findItem(componentView, path, indexMatch, indexName) {\n const item = find(componentView.get(path), indexMatch, indexName);\n if (hasValue(item)) {\n return item;\n }\n },\n getIndex(componentView, path, indexMatch, indexName) {\n const index = findIndex(componentView.get(path), indexMatch, indexName);\n if (hasValue(index)) {\n return index;\n }\n },\n async mergeItem(componentView, path, indexMatch, newVal, indexName) {\n const item = findItem(componentView.get(path), indexMatch, indexName);\n if (hasValue(item)) {\n assignDeep(item, newVal);\n await componentView.update(path);\n return item;\n }\n },\n async removeIndex(componentView, path, indexMatch, indexName) {\n const index = findIndex(componentView.get(path), indexMatch, indexName);\n if (hasValue(index)) {\n await componentView.splice(path, index, 1);\n }\n },\n async setIndex(componentView, path, indexMatch, item, indexName, optionsArg) {\n const options = optionsArg || {};\n const index = findIndex(componentView.get(path), indexMatch, indexName);\n if (hasValue(index)) {\n const pathSuffix = (options.pathSuffix) ? `.${options.pathSuffix}` : '';\n await componentView.set(`${path}.${index}${pathSuffix}`, item);\n } else if (get('conflict', options) === 'insert') {\n await componentView[get('conflictMethod', options) || 'push'](path, item);\n }\n },\n async sortNewest(componentView, path, property) {\n const array = componentView.get(path);\n sortNewest(array, property, true);\n await componentView.update(path);\n },\n async sortOldest(componentView, path, property) {\n const array = componentView.get(path);\n sortOldest(array, property, true);\n await componentView.update(path);\n },\n async syncCollection(componentView, path, newValArg, type = 'push', indexName = 'id') {\n const oldVal = componentView.get(path);\n if (isPlainObject(oldVal)) {\n assignDeep(oldVal, newValArg);\n } else {\n const newVal = ensureArray(newValArg);\n each(newVal, (item) => {\n const oldValItem = findItem(oldVal, item[indexName], indexName);\n if (hasValue(oldValItem)) {\n assign(oldValItem, item);\n } else {\n oldVal[type](item);\n }\n });\n }\n await componentView.update(path);\n },\n async toggleIndex(componentView, path, indexMatchArg, pathSuffixArg, indexName) {\n let indexMatch;\n const arrayCheck = isArray(indexMatchArg);\n if (arrayCheck && !isEmpty(indexMatchArg)) {\n indexMatch = indexMatchArg.shift();\n } else {\n indexMatch = indexMatchArg;\n }\n const index = findIndex(componentView.get(path), indexMatch, indexName);\n if (hasValue(index)) {\n const pathSuffix = (pathSuffixArg) ? `.${pathSuffixArg}` : '';\n await componentView.toggle(`${path}.${index}${pathSuffix}`);\n }\n if (arrayCheck && !isEmpty(indexMatchArg)) {\n await componentView.toggleIndex(path, indexMatchArg, pathSuffixArg, indexName);\n }\n },\n async updateItem(componentView, path, indexMatch, react, indexName) {\n const item = findItem(componentView.get(path), indexMatch, indexName);\n if (hasValue(item)) {\n react(item);\n await componentView.update(path);\n return item;\n }\n }\n};\nassign(componentMethods, {\n extendRactive(view) {\n each(extendRactive, (item, key) => {\n view[key] = function(...args) {\n return item(view, ...args);\n };\n });\n },\n});\n","import app from '../app';\nconst getComponentName = (componentModel, componentName) => {\n return (componentModel === app.router.currentStateObject) ? 'navState' : componentName;\n};\nexport default getComponentName;\n","import app from '../../app';\nconst {\n watch,\n demand,\n utility: {\n each,\n isFunction,\n }\n} = app;\nconst onHtml = async (matchFilename, componentName, json) => {\n const type = json.type;\n const filePath = json.name;\n if (!type.includes(matchFilename)) {\n return;\n }\n const html = await demand(filePath);\n if (isFunction(componentName)) {\n componentName(html);\n } else {\n each(app.findAllComponents(componentName), (item) => {\n item.resetTemplate(html);\n });\n }\n};\nconst watchHtml = (matchFilename, componentName) => {\n return watch(matchFilename, (json) => {\n onHtml(matchFilename, componentName, json);\n });\n};\nwatch.html = watchHtml;\nexport default watchHtml;\n","import app from '../app';\nimport getComponentName from './getComponentName';\nimport watchHtml from './watch/html';\nconst {\n utility: {\n each,\n }\n} = app;\nconst importPartials = (componentName, componentModel, asset) => {\n if (asset.partials) {\n each(asset.partials, (item, key) => {\n watchHtml(item, (html) => {\n const realName = getComponentName(componentModel, componentName);\n each(app.findAllComponents(realName), (subItem) => {\n subItem.resetPartial(key, html);\n });\n });\n });\n }\n};\nexport default importPartials;\n","import app from '../app';\nimport getComponentName from './getComponentName';\nimport watchHtml from './watch/html';\nconst importTemplate = (componentName, componentModel, asset) => {\n const template = asset.template;\n if (template) {\n watchHtml(template, (html) => {\n const realName = getComponentName(componentModel, componentName);\n if (realName) {\n app.findComponent(realName)\n .resetTemplate(html);\n }\n });\n }\n};\nexport default importTemplate;\n","import app from '../app';\nconst {\n utility: {\n each,\n }\n} = app;\nconst multiEvent = (view, componentEvent, ...events) => {\n each(events, (item) => {\n if (item) {\n each(item.split(','), (subItem) => {\n view.fire(subItem.trim(), componentEvent);\n });\n }\n });\n};\nexport default multiEvent;\n","import app from '../app';\nconst {\n isEventNode,\n utility: {\n isEnter,\n }\n} = app;\nconst preventDefault = function(callable) {\n return function(componentEvent, ...args) {\n if (componentEvent) {\n if (componentEvent.node && !isEventNode(componentEvent)) {\n componentEvent.notTarget = true;\n } else {\n componentEvent.isTarget = true;\n }\n const original = componentEvent.original;\n componentEvent.isEnter = (original && original.keyCode) ? isEnter(original) : true;\n }\n componentEvent.source = componentEvent.ractive;\n callable(componentEvent, ...args);\n return false;\n };\n};\nexport default preventDefault;\n","import app from '../app';\nconst {\n utility: {\n each,\n assign,\n querySelector,\n }\n} = app;\nconst headNode = querySelector('head');\nexport const importedCssCount = {};\nexport const importedCss = {};\nexport const render = (code, filePath) => {\n if (importedCss[filePath]) {\n importedCssCount[filePath]++;\n } else {\n importedCssCount[filePath] = 0;\n const node = document.createElement('style');\n node.innerHTML = code;\n node.setAttribute('data-src', filePath);\n headNode.appendChild(node);\n importedCss[filePath] = node;\n }\n};\nexport const unrender = (code, filePath) => {\n if (importedCss[filePath]) {\n importedCssCount[filePath]--;\n if (importedCssCount[filePath] < 0) {\n importedCss[filePath].remove();\n importedCss[filePath] = null;\n importedCssCount[filePath] = null;\n }\n }\n};\nexport const cssRender = (css) => {\n if (css) {\n each(css, render);\n }\n};\nexport const cssUnrender = (css) => {\n if (css) {\n each(css, unrender);\n }\n};\nexport const componentsWithCss = {};\nexport const registerCssComponent = (css, componentConfig) => {\n if (!css) {\n return;\n }\n each(css, (item, key) => {\n if (!componentsWithCss[key]) {\n componentsWithCss[key] = [];\n }\n componentsWithCss[key].push(componentConfig);\n });\n};\nassign(app, {\n componentsWithCss,\n importedCss,\n importedCssCount\n});\n","import app from '../app';\nimport multiEvent from './multiEvent';\nimport preventDefault from './preventDefault';\nimport { cssRender, cssUnrender } from './css';\nconst {\n componentMethods,\n watch,\n utility: {\n map,\n each,\n get,\n ifInvoke\n }\n} = app;\nconst createWatchers = (view, item, key) => {\n if (get('isWatcher', item._)) {\n view.watchers[key] = item;\n return;\n }\n item.options = item.options || {};\n item.methods = item.methods || {};\n let {\n prefix,\n suffix,\n } = item.options;\n const {\n methods,\n } = item;\n const createMethod = methods.create || 'push';\n const readMethod = methods.read || 'push';\n prefix = (prefix) ? `${prefix}.` : '';\n suffix = (suffix) ? `.${suffix}` : '';\n item.prefix = prefix;\n item.suffix = suffix;\n view.watchers[key] = watch({\n async create(json) {\n await view.syncCollection(key, json.item, createMethod);\n view.fire(`${prefix}create${suffix}`, json.item, json);\n },\n delete(json) {\n view.removeIndex(key, json.item.id);\n view.fire(`${prefix}delete${suffix}`, json.item, json);\n },\n async read(json) {\n await view.syncCollection(key, json.items, readMethod);\n view.fire(`${prefix}read${suffix}`, json.item, json);\n },\n async update(json) {\n await view.syncCollection(key, json.item, createMethod);\n view.fire(`${prefix}update${suffix}`, json.item, json);\n },\n }, item.options);\n};\nconst removeInstance = function(view, css) {\n cssUnrender(css);\n each(view.watchers, (item, key) => {\n item.stop();\n item[key] = null;\n });\n};\nconst onrenderInstance = function(view, css) {\n cssRender(css);\n if (view.watchers) {\n each(view.watchers, (item) => {\n item.start();\n });\n }\n};\nexport const constructEvent = function(componentConfig, componentEvent, sourceConstruct) {\n const {\n css,\n watchers,\n } = componentConfig;\n const view = componentEvent.ractive;\n const componentModel = componentConfig.model;\n const sourceOn = view.on.bind(view);\n if (sourceConstruct) {\n sourceConstruct(componentEvent, view);\n }\n if (componentModel) {\n app.navState = componentEvent.ractive;\n }\n view.onRaw = (componentEvt) => {\n componentEvt.source = componentEvt.ractive;\n return sourceOn(componentEvt);\n };\n view.on = (eventName, eventListener) => {\n if (eventListener) {\n return sourceOn(eventName, preventDefault(eventListener));\n } else {\n return sourceOn(map(eventName, preventDefault));\n }\n };\n each(componentMethods, (item) => {\n item(view, componentConfig);\n });\n view.watchers = (watchers) ? watchers(view) : {};\n if (view.watchers) {\n each(view.watchers, (item, key) => {\n createWatchers(view, item, key);\n });\n }\n view.on({\n multi(cmpntEvent, ...args) {\n return multiEvent(view, cmpntEvent, ...args);\n },\n render() {\n onrenderInstance(view, css);\n },\n teardown() {\n removeInstance(view, css);\n },\n });\n};\nconst onConstruct = (componentConfig) => {\n const sourceConstruct = componentConfig.onconstruct;\n componentConfig.onconstruct = function(componentEvent) {\n componentEvent.source = componentEvent.ractive;\n constructEvent(componentConfig, componentEvent, sourceConstruct);\n };\n const sourceRender = componentConfig.onrender;\n componentConfig.onrender = function(componentEvent) {\n componentEvent.source = componentEvent.ractive;\n ifInvoke(sourceRender, componentEvent);\n };\n};\nexport default onConstruct;\n","import app from '../app';\nimport importPartials from './importPartials';\nimport importTemplate from './importTemplate';\nimport onConstruct from './onConstruct';\nimport { registerCssComponent } from './css';\nconst {\n utility: {\n cnsl,\n assign,\n }\n} = app;\ncnsl('viewSetup Module', 'notify');\nconst tooltip = window.RactiveTooltip;\nconst initializeComponent = (componentConfig) => {\n componentConfig.decorators = assign(componentConfig.decorators || {}, {\n tooltip,\n });\n const {\n css,\n model: componentModel,\n asset,\n name: componentName,\n } = componentConfig;\n registerCssComponent(css, componentConfig);\n if (asset && (componentName || componentModel)) {\n importTemplate(componentName, componentModel, asset);\n importPartials(componentName, componentModel, asset);\n }\n onConstruct(componentConfig);\n};\nexport default initializeComponent;\n","import initializeComponent from './initializeComponent.js';\nconst ractive = window.Ractive;\nconst buildComponent = (componentConfig) => {\n initializeComponent(componentConfig);\n const componentName = componentConfig.name;\n const componentModel = componentConfig.model;\n const Component = ractive.extend(componentConfig);\n if (componentName) {\n ractive.components[componentName] = Component;\n }\n if (componentModel) {\n componentModel.component = Component;\n }\n return Component;\n};\nexport default buildComponent;\n","import app from '../app';\nimport buildComponent from './buildComponent.js';\nconst {\n demand,\n demandCss,\n demandHtml,\n utility: {\n assign,\n each,\n ensureArray,\n isString,\n }\n} = app;\nconst asyncComponent = async function(componentConfig) {\n const componentModel = componentConfig.model;\n let asset = componentConfig.asset || {};\n if (isString(asset)) {\n asset = {\n css: [`${asset}style`],\n template: `${asset}template`,\n };\n }\n componentConfig.asset = asset;\n componentConfig.css = componentConfig.css || {};\n componentConfig.partials = componentConfig.partials || {};\n if (asset) {\n if (asset.template) {\n componentConfig.template = await demandHtml(asset.template);\n }\n if (asset.demand) {\n componentConfig.demand = await demand(asset.demand);\n }\n if (asset.partials) {\n assign(componentConfig.partials, await demandHtml(asset.partials));\n }\n if (asset.css) {\n const assetCss = asset.css;\n const loadCss = await demandCss(assetCss);\n each(ensureArray(loadCss), (item, index) => {\n let keyName = assetCss[index];\n if (!keyName.includes('.css')) {\n keyName = `${keyName}.css`;\n }\n componentConfig.css[keyName] = item;\n });\n }\n }\n const componentPromise = buildComponent(componentConfig);\n if (componentModel) {\n componentModel.component = componentPromise;\n }\n return componentPromise;\n};\nexport default asyncComponent;\n","import app from '../app';\nimport asyncComponent from './asyncComponent';\nimport buildComponent from './buildComponent';\nconst {\n utility: {\n isString\n }\n} = app;\nconst components = {};\nconst generateComponent = (ComponentView, config) => {\n return new ComponentView(config);\n};\nconst getComponent = (componentName, config) => {\n const componentObject = components[componentName];\n return config ? generateComponent(componentObject, config) : componentObject;\n};\nconst component = (componentName, componentConfigOption) => {\n let method;\n const componentConfig = (componentConfigOption) ? componentConfigOption : componentName;\n if (isString(componentName)) {\n componentConfig.name = componentName;\n }\n if (componentConfig.asset) {\n method = asyncComponent;\n } else {\n method = buildComponent;\n }\n return method(componentConfig);\n};\napp.component = component;\napp.getComponent = getComponent;\n","import app from '../../app';\nimport {\n componentsWithCss,\n importedCss,\n} from '../css';\nconst {\n demand,\n watch,\n utility: {\n each,\n querySelector,\n isDom\n }\n} = app;\nexport const onCss = async (json) => {\n const filePath = json.name;\n const componentName = json.type;\n const componentsUsingCss = componentsWithCss[componentName];\n const node = importedCss[filePath] || importedCss[componentName] || querySelector(`[data-src=\"${filePath}\"]`);\n if (node || componentsUsingCss) {\n const content = await demand(filePath);\n if (isDom(node)) {\n node.innerHTML = content;\n }\n if (componentsUsingCss) {\n each(componentsUsingCss, (item) => {\n item.asset.css[componentName] = content;\n });\n }\n }\n};\nwatch(/\\.css/, onCss);\n","import app from '../app';\nconst {\n componentMethods,\n demand,\n utility: {\n assign,\n each,\n isFunction\n }\n} = app;\nconst RactiveComponent = window.Ractive;\nconst view = new RactiveComponent({\n data() {\n return {\n components: {\n dynamic: {},\n layout: {},\n main: {},\n },\n notification: [],\n pageTitle: '',\n screenSize: '',\n };\n },\n template: `{{#components.main:key}}{{>getComponent(key)}}{{/}}`,\n});\nview.on({\n async '*.loadComponent'(componentEvent) {\n const imported = await demand(componentEvent.get('demand'));\n const afterDemand = componentEvent.get('afterDemand');\n if (afterDemand) {\n const afterDemandEvents = afterDemand[componentEvent.original.type];\n each(afterDemandEvents, (item, key) => {\n if (isFunction(item)) {\n item(imported, item, key);\n } else {\n app.findComponent(key)\n .fire(item);\n }\n });\n }\n },\n '*.preventDefault'() {\n return false;\n },\n});\ncomponentMethods.extendRactive(view);\napp.importComponent = async (componentName, importURL, type = 'dynamic') => {\n if (importURL) {\n await demand(importURL);\n }\n await app.view.set(`components.${type}.${componentName}`, true);\n await view.update('components.${type}');\n};\nconst pageTitleComponent = new RactiveComponent({\n append: true,\n data() {\n return {\n text() {\n return view.get('pageTitle');\n }\n };\n },\n template: `{{text()}}`,\n});\nassign(app, {\n async render() {\n await view.render('body');\n await pageTitleComponent.render('head');\n },\n view,\n});\n","import app from '../app';\nconst {\n utility: {\n drop\n }\n} = app;\nlet notificationStatus;\nconst notifications = [];\nconst\tspawnNotification = (data) => {\n if (notificationStatus) {\n const notification = new Notification(data.title, {\n body: data.body,\n icon: data.icon\n }, data.options);\n const number = notifications.push(notification) - 1;\n setTimeout(() => {\n notification.close();\n drop(notifications, number, 1);\n }, data.time || 4000);\n return notification;\n }\n};\napp.notify = async (data) => {\n if (Notification.permission === 'granted') {\n return spawnNotification(data);\n } else if (Notification.permission !== 'denied') {\n const permission = await Notification.requestPermission();\n if (permission === 'granted') {\n spawnNotification({\n body: 'enabled',\n title: 'Notifications',\n });\n }\n }\n};\nexport const setupNotification = async () => {\n notificationStatus = await Notification.requestPermission();\n};\n","import app from '../app';\nconst {\n demandJs,\n demandLang,\n componentMethods,\n utility: {\n cnsl,\n assign,\n each,\n map,\n isString,\n rest,\n camelCase,\n omit,\n last,\n batch,\n eventAdd,\n has,\n whileArray,\n },\n} = app;\nconst ractive = window.Ractive;\nconst router = {};\nconst hostname = window.location.hostname;\nconst origin = window.location.origin;\ncnsl('ROUTER ONLINE', 'important');\nassign(router, {\n add(item) {\n each(item, router.addObject);\n },\n addObject(item, key) {\n const reg = new RegExp(key);\n router.routes.push(() => {\n return router.routeChecker(item, reg);\n });\n },\n attachEvents() {\n eventAdd(window, 'popstate', (eventArg) => {\n router.saveState();\n router.updateLocation();\n router.loadState();\n eventArg.preventDefault();\n }, true);\n },\n closeState(previousStateObject) {\n if (previousStateObject) {\n if (!previousStateObject.closed) {\n router.forceClose(previousStateObject);\n }\n }\n },\n forceClose(sourceState) {\n app.view.set('navState', false);\n const nullCurrentState = Boolean(sourceState);\n const currentStateObject = sourceState || router.currentStateObject;\n if (currentStateObject) {\n if (router.currentStateObject.watchers) {\n router.currentStateObject.watchers.stop();\n }\n currentStateObject.closed = true;\n if (currentStateObject.close) {\n batch(currentStateObject.close);\n }\n if (nullCurrentState) {\n router.currentStateObject = null;\n }\n }\n },\n go(route) {\n router.openState(route);\n if (router.analytics) {\n router.analytics();\n }\n },\n isCurrentModel(model, success, failure) {\n const check = (router.currentStateObject) ? router.currentStateObject === model : false;\n if (check) {\n if (success) {\n success();\n }\n } else if (failure) {\n failure();\n }\n return check;\n },\n loadState() {\n cnsl('Router Loading State', 'notify');\n whileArray(router.routes, (item) => {\n return Boolean(item()) === false;\n });\n },\n location: {\n previous: {},\n },\n objectRoutes: {},\n openState(openModel) {\n // close event\n const previousStateObject = router.currentStateObject;\n if (openModel) {\n router.currentStateObject = openModel;\n if (!openModel.panel) {\n router.closeState(previousStateObject);\n }\n if (openModel.closed || openModel.closed === undefined) {\n if (openModel.open) {\n batch(openModel.open);\n }\n openModel.closed = false;\n }\n } else {\n router.currentStateObject = null;\n router.closeState(previousStateObject);\n }\n if (router.currentStateObject && router.currentStateObject.component) {\n (async () => {\n await app.view.set('navState', false);\n ractive.components.navState = router.currentStateObject.component;\n await app.view.set('navState', true);\n if (router.currentStateObject.watchers) {\n router.currentStateObject.watchers.start();\n }\n })();\n }\n },\n async pushState(url) {\n if (url) {\n await router.saveState();\n await router.setState(url, url);\n await router.updateLocation();\n await router.loadState();\n }\n },\n reloadState(sourceState) {\n const currentStateObject = sourceState || router.currentStateObject;\n if (currentStateObject) {\n if (currentStateObject.reload) {\n batch(currentStateObject.reload);\n }\n }\n },\n routeChecker(data, reg) {\n const matching = router.location.pathname.match(reg);\n console.log(router.location.pathname, matching, reg);\n if (matching) {\n router.match = matching;\n const route = data.route();\n let routePath = (last(route.path) === '/') ? route.path : `${route.path}/`;\n routePath = (routePath[0] === '/') ? routePath : `/${routePath}`;\n route.path = routePath;\n const routeRequire = data.require;\n if (router.objectRoutes[routePath]) {\n router.go(router.objectRoutes[routePath]);\n } else {\n (async () => {\n if (!data.loaded && routeRequire) {\n await demandJs(routeRequire);\n }\n const object = await demandJs(`routes${routePath}`);\n const lang = await demandLang(routePath);\n if (object.component && object.component.then) {\n await object.component;\n }\n object.assets = object.assets || {};\n if (lang) {\n object.assets.language = lang;\n }\n if (object.compile) {\n await object.compile();\n }\n router.objectRoutes[routePath] = object;\n router.go(object);\n data.loaded = true;\n })();\n }\n }\n return matching;\n },\n routes: [],\n saveState() {\n assign(router.location.previous, omit(router.location, ['previous']));\n },\n setState(url, title, object) {\n // pushState\n if (hostname + url === hostname + window.location.pathname) {\n router.reloadState();\n } else {\n history.pushState(object, title, url);\n }\n },\n setup() {\n router.updateLocation();\n router.attachEvents();\n router.loadState();\n },\n updateLocation() {\n map(top.location, (item, index) => {\n if (isString(item)) {\n router.location[index] = item;\n }\n });\n router.location.pathScored = router.location.pathname.replace(/\\//g, '_');\n router.location.paths = rest(router.location.pathname.split('/'));\n router.location.pathCamel = camelCase(router.location.paths.join('_'));\n }\n});\ncomponentMethods.routerLoad = (componentView) => {\n componentView.on({\n routerBack() {\n if (router.location.previous.hostname) {\n window.history.back();\n } else {\n router.pushState('/');\n }\n },\n routerForward() {\n if (router.location.previous.hostname) {\n window.history.forward();\n } else {\n router.pushState('/');\n }\n },\n routerLoad(eventArg) {\n const href = eventArg.node.href;\n const node = event.node;\n if (!href) {\n router.pushState(event.get('href') || node.getAttribute('data-href'));\n } else if (has(href, origin) || has(href, hostname)) {\n event.preventDefault();\n router.pushState(node.getAttribute('href'));\n }\n return false;\n },\n });\n};\nassign(app, {\n router,\n});\n"],"names":["demand","each","assign","componentMethods","watch","get","ensureArray","isString","querySelector","isFunction","view","cnsl","map","eventAdd","ractive"],"mappings":";;;AAAA,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG;;ACCtB,MAAM,QAAQ,GAAG;EACf,KAAK,GAAG;IACN,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;GACxB;CACF,CAAC;AACF,QAAQ,CAAC,KAAK,EAAE,CAAC;AACjB,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC;;ACNxB,MAAM;EACJ,OAAO,EAAE;IACP,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,IAAI;IACJ,KAAK;GACN;EACD,IAAI;CACL,GAAG,GAAG,CAAC;AACR,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM;EAClC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;EAC5C,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;EAC1C,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE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CAAC;OAC7C;MACD,OAAO,KAAK,CAAC;KACd;GACF,CAAC,CAAC;CACJ,CAAC;AACFD,QAAM,CAAC,GAAG,EAAE;EACV,MAAM;CACP,CAAC,CAAC;;;;"} \ No newline at end of file diff --git a/uwBridge/system/compile/index.js b/uwBridge/system/compile/index.js index 56a219af..d23ec73e 100644 --- a/uwBridge/system/compile/index.js +++ b/uwBridge/system/compile/index.js @@ -97,7 +97,6 @@ const compileApps = async () => { each(apps, (item) => { console.log(`Exporting Files to ${item}.`); copyFile(`./build/front/bundle.js`, `./../../apps/client/${item}/filesystem/public/Sentivate.js`); - copyFile(`./build/socket/bundle.js`, `./../../apps/client/${item}/filesystem/asset/Sentivate/index.js`); copyFile(`./build/worker/bundle.js`, `./../../apps/client/${item}/filesystem/public/worker.js`); console.log(`Exporting Files to ${item} Completed.`); }); @@ -116,7 +115,6 @@ exports.build = async (options) => { copyFile(`./../../../node_modules/ractive/ractive.min.js`, `./source/front/libs/ractive.js`); console.log('ractive Imported'); await bundle('front', options); - await bundle('socket', options); await bundle('worker', options); console.log('-----------Export To Apps-----------'); const apps = await getApps(); @@ -134,18 +132,6 @@ exports.build = async (options) => { }); }); console.log('Watching Front'); - watch('./source/socket', { - recursive: true - }, async () => { - console.log('LIVE CHANGE DETECTED COMPILE socket'); - each(apps, (item) => { - console.log(`Exporting Files to ${item}.`); - copyFile(`./build/socket/bundle.js`, `./../../apps/client/${item}/filesystem/asset/Sentivate/index.js`); - console.log(`Exporting Files to ${item} Completed.`); - }); - await bundle('socket', options); - }); - console.log('Watching Socket'); watch('./source/worker', { recursive: true }, async () => { diff --git a/uwBridge/system/compile/source/front/core/app.js b/uwBridge/system/compile/source/front/core/app.js index 71e0ca68..703c4568 100644 --- a/uwBridge/system/compile/source/front/core/app.js +++ b/uwBridge/system/compile/source/front/core/app.js @@ -3,6 +3,17 @@ const app = { start(data) { return app.workerRequest('configure', data); }, + log(...args) { + if (app.debug) { + apply(console.log, console, args); + } + }, + security: { + clear() { + app.log('Cleanup'); + app.crate.clear(); + } + }, utility: window.$, }; window.app = app; diff --git a/uwBridge/system/compile/source/socket/component/asyncComponent.js b/uwBridge/system/compile/source/front/core/component/asyncComponent.js similarity index 100% rename from uwBridge/system/compile/source/socket/component/asyncComponent.js rename to uwBridge/system/compile/source/front/core/component/asyncComponent.js diff --git a/uwBridge/system/compile/source/socket/component/buildComponent.js b/uwBridge/system/compile/source/front/core/component/buildComponent.js similarity index 100% rename from uwBridge/system/compile/source/socket/component/buildComponent.js rename to uwBridge/system/compile/source/front/core/component/buildComponent.js diff --git a/uwBridge/system/compile/source/socket/component/component.js b/uwBridge/system/compile/source/front/core/component/component.js similarity index 96% rename from uwBridge/system/compile/source/socket/component/component.js rename to uwBridge/system/compile/source/front/core/component/component.js index 1ba0ea6b..99b81baf 100644 --- a/uwBridge/system/compile/source/socket/component/component.js +++ b/uwBridge/system/compile/source/front/core/component/component.js @@ -20,6 +20,7 @@ const component = (componentName, componentConfigOption) => { if (isString(componentName)) { componentConfig.name = componentName; } + console.log(componentConfig); if (componentConfig.asset) { method = asyncComponent; } else { diff --git a/uwBridge/system/compile/source/socket/component/css.js b/uwBridge/system/compile/source/front/core/component/css.js similarity index 100% rename from uwBridge/system/compile/source/socket/component/css.js rename to uwBridge/system/compile/source/front/core/component/css.js diff --git a/uwBridge/system/compile/source/socket/component/defaultData.js b/uwBridge/system/compile/source/front/core/component/defaultData.js similarity index 100% rename from uwBridge/system/compile/source/socket/component/defaultData.js rename to uwBridge/system/compile/source/front/core/component/defaultData.js diff --git a/uwBridge/system/compile/source/socket/component/extendRactive.js b/uwBridge/system/compile/source/front/core/component/extendRactive.js similarity index 100% rename from uwBridge/system/compile/source/socket/component/extendRactive.js rename to uwBridge/system/compile/source/front/core/component/extendRactive.js diff --git a/uwBridge/system/compile/source/socket/component/getComponentName.js b/uwBridge/system/compile/source/front/core/component/getComponentName.js similarity index 100% rename from uwBridge/system/compile/source/socket/component/getComponentName.js rename to uwBridge/system/compile/source/front/core/component/getComponentName.js diff --git a/uwBridge/system/compile/source/socket/component/importPartials.js b/uwBridge/system/compile/source/front/core/component/importPartials.js similarity index 100% rename from uwBridge/system/compile/source/socket/component/importPartials.js rename to uwBridge/system/compile/source/front/core/component/importPartials.js diff --git a/uwBridge/system/compile/source/socket/component/importTemplate.js b/uwBridge/system/compile/source/front/core/component/importTemplate.js similarity index 100% rename from uwBridge/system/compile/source/socket/component/importTemplate.js rename to uwBridge/system/compile/source/front/core/component/importTemplate.js diff --git a/uwBridge/system/compile/source/socket/component/index.js b/uwBridge/system/compile/source/front/core/component/index.js similarity index 100% rename from uwBridge/system/compile/source/socket/component/index.js rename to uwBridge/system/compile/source/front/core/component/index.js diff --git a/uwBridge/system/compile/source/socket/component/initializeComponent.js b/uwBridge/system/compile/source/front/core/component/initializeComponent.js similarity index 100% rename from uwBridge/system/compile/source/socket/component/initializeComponent.js rename to uwBridge/system/compile/source/front/core/component/initializeComponent.js diff --git a/uwBridge/system/compile/source/socket/component/multiEvent.js b/uwBridge/system/compile/source/front/core/component/multiEvent.js similarity index 100% rename from uwBridge/system/compile/source/socket/component/multiEvent.js rename to uwBridge/system/compile/source/front/core/component/multiEvent.js diff --git a/uwBridge/system/compile/source/socket/component/onConstruct.js b/uwBridge/system/compile/source/front/core/component/onConstruct.js similarity index 100% rename from uwBridge/system/compile/source/socket/component/onConstruct.js rename to uwBridge/system/compile/source/front/core/component/onConstruct.js diff --git a/uwBridge/system/compile/source/socket/component/preventDefault.js b/uwBridge/system/compile/source/front/core/component/preventDefault.js similarity index 95% rename from uwBridge/system/compile/source/socket/component/preventDefault.js rename to uwBridge/system/compile/source/front/core/component/preventDefault.js index b48c02af..9ece3d37 100644 --- a/uwBridge/system/compile/source/socket/component/preventDefault.js +++ b/uwBridge/system/compile/source/front/core/component/preventDefault.js @@ -1,4 +1,4 @@ -import app from '../app'; +import app from './app.js'; const { isEventNode, utility: { diff --git a/uwBridge/system/compile/source/socket/component/view.js b/uwBridge/system/compile/source/front/core/component/view.js similarity index 100% rename from uwBridge/system/compile/source/socket/component/view.js rename to uwBridge/system/compile/source/front/core/component/view.js diff --git a/uwBridge/system/compile/source/socket/component/watch/css.js b/uwBridge/system/compile/source/front/core/component/watch/css.js similarity index 100% rename from uwBridge/system/compile/source/socket/component/watch/css.js rename to uwBridge/system/compile/source/front/core/component/watch/css.js diff --git a/uwBridge/system/compile/source/socket/component/watch/html.js b/uwBridge/system/compile/source/front/core/component/watch/html.js similarity index 100% rename from uwBridge/system/compile/source/socket/component/watch/html.js rename to uwBridge/system/compile/source/front/core/component/watch/html.js diff --git a/uwBridge/system/compile/source/front/core/demand.js b/uwBridge/system/compile/source/front/core/demand.js index a3585d0e..b0bd3db2 100644 --- a/uwBridge/system/compile/source/front/core/demand.js +++ b/uwBridge/system/compile/source/front/core/demand.js @@ -131,8 +131,6 @@ assign(app.events, { cnsl('Worker is Ready', 'notify'); app.systemLanguage = data.language; try { - await demand('Sentivate/'); - app.translate = await demand('language/global'); await demand('app/'); } catch (error) { console.log(error); diff --git a/uwBridge/system/compile/source/front/core/fetchFile.js b/uwBridge/system/compile/source/front/core/fetchFile.js index 0353ddb7..1ca010d2 100644 --- a/uwBridge/system/compile/source/front/core/fetchFile.js +++ b/uwBridge/system/compile/source/front/core/fetchFile.js @@ -123,11 +123,7 @@ export const fetchFile = async (config) => { await workerRequest({ async callback(json) { if (hasValue(json.file)) { - try { - await saveCompleted(json, config); - } catch (err) { - console.log(config, json.file); - } + await saveCompleted(json, config); } else { return checkIfCompleted(config); } diff --git a/uwBridge/system/compile/source/front/core/index.js b/uwBridge/system/compile/source/front/core/index.js index 477d5994..963ff64c 100644 --- a/uwBridge/system/compile/source/front/core/index.js +++ b/uwBridge/system/compile/source/front/core/index.js @@ -5,3 +5,7 @@ import './demand.js'; import './worker.js'; import './request.js'; import './watchers.js'; +import './notifications.js'; +import './resize.js'; +import './component/index.js'; +import './router.js'; diff --git a/uwBridge/system/compile/source/socket/notifications/index.js b/uwBridge/system/compile/source/front/core/notifications.js similarity index 97% rename from uwBridge/system/compile/source/socket/notifications/index.js rename to uwBridge/system/compile/source/front/core/notifications.js index 8abda506..e3f6f6ad 100644 --- a/uwBridge/system/compile/source/socket/notifications/index.js +++ b/uwBridge/system/compile/source/front/core/notifications.js @@ -1,4 +1,4 @@ -import app from '../app'; +import app from './app.js'; const { utility: { drop diff --git a/uwBridge/system/compile/source/socket/events/resize.js b/uwBridge/system/compile/source/front/core/resize.js similarity index 99% rename from uwBridge/system/compile/source/socket/events/resize.js rename to uwBridge/system/compile/source/front/core/resize.js index fb496b78..720fd3b4 100644 --- a/uwBridge/system/compile/source/socket/events/resize.js +++ b/uwBridge/system/compile/source/front/core/resize.js @@ -1,4 +1,4 @@ -import app from '../app'; +import app from './app.js'; const { utility: { debounce, diff --git a/uwBridge/system/compile/source/front/core/router.js b/uwBridge/system/compile/source/front/core/router.js new file mode 100644 index 00000000..ddde8f36 --- /dev/null +++ b/uwBridge/system/compile/source/front/core/router.js @@ -0,0 +1,224 @@ +import app from './app.js'; +localStorage.clear(); +const { + demandJs, + utility: { + cnsl, + assignDeep, + mapArray, + map, + isString, + rest, + camelCase, + eventAdd, + apply, + isRegExp, + mapWhile, + ifInvoke, + hasValue, + last + }, + component +} = app; +cnsl('ROUTER ONLINE', 'important'); +class Router { + constructor() { + return this; + } + debug = false; + hostname = location.hostname; + pathname = location.pathname; + navHistory = []; + historyIndex = 0; + routes = []; + methods = {}; + defaults = { + protected: false, + role: false, + }; + state; + log(...args) { + if (this.debug || app.debug) { + apply(console.log, console, args); + } + } + popstate(popstateEvent) { + app.router.log('popstate', popstateEvent); + popstateEvent.preventDefault(); + app.router.process(); + } + pushState(url) { + history.pushState({}, url, url); + app.router.process(); + } + installRoute(routeModel) { + app.router.log('Install Route', routeModel); + const { + match + } = routeModel; + if (match) { + routeModel.regex = isRegExp(match) ? match : new RegExp(match); + } + return app.router.routes.push(routeModel); + } + add(item) { + this.log('add routes', item); + return mapArray(item, this.installRoute); + } + async setup(options) { + this.log('setup router'); + this.add(options.routes); + this.log('assign options'); + assignDeep(this, options); + this.log('eventAdd popstate'); + eventAdd(window, 'popstate', this.popstate, true); + await this.process(); + } + async updateLocation() { + map(location, (item, index) => { + if (isString(item)) { + this[index] = item; + } + }); + this.pathScored = this.pathname.replace(/\//g, '_'); + this.paths = rest(this.pathname.split('/')); + this.pathCamel = camelCase(this.paths.join('_')); + this.navHistory.push(this.pathname); + this.historyIndex++; + } + async compilePath() { + const { + route, + secured, + role, + path + } = this.pathState; + this.log(this.pathState); + if (route) { + this.pathState.path = route(); + } else if (!path) { + this.pathState.path = this.pathname; + } + if (last(this.pathState.path) !== '/') { + this.pathState.path = `${this.pathState.path}/`; + } + if (this.pathState.path[0] !== '/') { + this.pathState.path = `/${this.pathState.path}`; + } + if (secured) { + const securityCheck = Boolean(await this.methods.security(this.match)); + if (securityCheck) { + const success = await this.methods.success(); + if (role) { + this.pathState.path = `${path}${success}/`; + } + } else { + this.pathState.path = `/${await this.methods.fail()}/`; + } + } + this.pathState.path = `/${this.defaults.root}${this.pathState.path}index`; + } + checkMatch(routeObject) { + const check = routeObject.regex.test(app.router.pathname); + if (check) { + app.router.routeState = routeObject; + } + app.router.log(check, app.router.pathname, routeObject.regex); + return !check; + } + async close() { + const currentComponent = this.component; + if (currentComponent) { + console.log('Close Component', this, currentComponent); + await app.view.findComponent('navstate').teardown(); + this.component = null; + } + } + async process() { + app.view.fire('router.loading'); + this.log('Router Loading State'); + this.updateLocation(); + this.log(this.routes); + mapWhile(this.routes, this.checkMatch); + const match = app.router.routeState; + this.log('Match found', match); + if (match) { + await this.close(); + const { + path, + route + } = match; + const secured = hasValue(match.secured) ? match.secured : this.defaults.secured; + const role = hasValue(match.role) ? match.role : this.defaults.role; + const pathState = { + match, + secured, + role, + path, + route + }; + this.pathState = pathState; + this.match = match; + await this.compilePath(); + await Ractive.sharedSet('@shared.currentPath', this.pathname); + await Ractive.sharedSet('navState', false); + this.log('Checking if Model Loaded', match.model); + if (!match.model) { + if (match.assets) { + if (match.assets.scripts) { + await demandJs(match.assets.scripts); + } + } + this.log('match model', pathState.path); + match.model = await demandJs(pathState.path); + this.log(match.model); + } + this.state = match; + const initializeComponent = await component(match.model.component); + this.log('component made', initializeComponent); + Ractive.components.navstate = initializeComponent; + ifInvoke(match.model.open); + ifInvoke(this.methods.onLoad); + await Ractive.sharedSet('navState', true); + } else { + return false; + } + this.log('Finished processing'); + } + back() { + this.log('Router back State'); + const navHistory = this.navHistory; + if (navHistory.length) { + router.historyIndex--; + window.history.back(); + } + } + forward() { + this.log('Router forward State'); + const navHistory = this.navHistory; + if (navHistory.length > this.historyIndex) { + router.historyIndex++; + window.history.forward(); + } + } +} +app.router = new Router(); +app.view.on({ + '*.routerBack'() { + app.router.back(); + }, + '*.routerForward'() { + app.router.forward(); + }, + '*.route'(componentEvent) { + const { + original, + node + } = componentEvent; + const url = componentEvent.get('href') || node.getAttribute('href') || node.getAttribute('data-href'); + original.preventDefault(); + app.router.log(componentEvent, url); + app.router.pushState(url); + return false; + }, +}); diff --git a/uwBridge/system/compile/source/front/libs/index.js b/uwBridge/system/compile/source/front/libs/index.js index 6fcff6f7..40fea8de 100644 --- a/uwBridge/system/compile/source/front/libs/index.js +++ b/uwBridge/system/compile/source/front/libs/index.js @@ -1,4 +1,3 @@ import './ractive.js'; -import './ractivePlugins'; import './Acid'; import '../../../build/front/coreBundle'; diff --git a/uwBridge/system/compile/source/front/libs/ractivePlugins.js b/uwBridge/system/compile/source/front/libs/ractivePlugins.js deleted file mode 100644 index e69de29b..00000000 diff --git a/uwBridge/system/compile/source/socket/app.js b/uwBridge/system/compile/source/socket/app.js deleted file mode 100644 index 9b4bd2fa..00000000 --- a/uwBridge/system/compile/source/socket/app.js +++ /dev/null @@ -1 +0,0 @@ -export default window.app; diff --git a/uwBridge/system/compile/source/socket/core/index.js b/uwBridge/system/compile/source/socket/core/index.js deleted file mode 100644 index dae91a02..00000000 --- a/uwBridge/system/compile/source/socket/core/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import '../security/index'; -import '../events/index'; -import '../component/index'; -import '../notifications/index'; -import '../router/index'; diff --git a/uwBridge/system/compile/source/socket/events/index.js b/uwBridge/system/compile/source/socket/events/index.js deleted file mode 100644 index ed9eca01..00000000 --- a/uwBridge/system/compile/source/socket/events/index.js +++ /dev/null @@ -1 +0,0 @@ -import './resize'; diff --git a/uwBridge/system/compile/source/socket/libs/index.js b/uwBridge/system/compile/source/socket/libs/index.js deleted file mode 100644 index 25bfa36a..00000000 --- a/uwBridge/system/compile/source/socket/libs/index.js +++ /dev/null @@ -1 +0,0 @@ -import '../../../build/socket/coreBundle'; diff --git a/uwBridge/system/compile/source/socket/router/index.js b/uwBridge/system/compile/source/socket/router/index.js deleted file mode 100644 index a7c98833..00000000 --- a/uwBridge/system/compile/source/socket/router/index.js +++ /dev/null @@ -1 +0,0 @@ -import './setup'; diff --git a/uwBridge/system/compile/source/socket/router/setup.js b/uwBridge/system/compile/source/socket/router/setup.js deleted file mode 100644 index 706d6f8d..00000000 --- a/uwBridge/system/compile/source/socket/router/setup.js +++ /dev/null @@ -1,283 +0,0 @@ -import app from '../app'; -const { - demandJs, - demandLang, - utility: { - cnsl, - assign, - each, - map, - isString, - rest, - camelCase, - omit, - last, - batch, - eventAdd, - apply - }, -} = app; -const router = {}; -const hostname = window.location.hostname; -router.historyIndex = 0; -const logRouter = console; -function debugRouter(...args) { - if (app.debug || app.debugRouter) { - apply(logRouter.log, logRouter, args); - } -} -Ractive.sharedSet('historyIndex', router.historyIndex); -cnsl('ROUTER ONLINE', 'important'); -assign(router, { - add(item) { - each(item, router.addObject); - }, - addObject(item, key) { - const reg = new RegExp(key); - router.routes.push(async () => { - return router.routeChecker(item, reg); - }); - }, - attachEvents() { - eventAdd(window, 'popstate', async (eventArg) => { - debugRouter('popstate', eventArg); - router.saveState(); - router.updateLocation(); - await router.loadState(); - eventArg.preventDefault(); - }, true); - }, - async closeState(previousStateObject) { - debugRouter('closeState', previousStateObject); - if (previousStateObject) { - if (!previousStateObject.closed) { - debugRouter('forceClose', previousStateObject); - return router.forceClose(previousStateObject); - } - return debugRouter('Previous State Marked As Closed', previousStateObject); - } - }, - async forceClose(sourceState) { - app.view.set('navState', false); - debugRouter('forceClose', sourceState); - if (sourceState) { - if (sourceState.watchers) { - sourceState.watchers.stop(); - } - if (sourceState.close) { - debugRouter('MODEL Close STATE', sourceState); - await sourceState.close(); - } - sourceState.closed = true; - } - }, - go(route) { - if (router.analytics) { - router.analytics(); - } - return router.openState(route); - }, - isCurrentModel(modelSafe, success, failure) { - const check = (router.currentStateObject) ? router.currentStateObject === modelSafe : false; - if (check) { - if (success) { - success(); - } - } else if (failure) { - failure(); - } - return check; - }, - async loadState() { - cnsl('Router Loading State', 'notify'); - const routesLength = router.routes.length; - let index = 0; - while (index < routesLength) { - const item = router.routes[index]; - const result = Boolean(await item()) === false; - index++; - if (result === false) { - debugRouter('LOAD STATE', item, result); - app.view.fire('location.update'); - break; - } - } - }, - location: { - previous: {}, - }, - objectRoutes: {}, - async openState(openModel) { - // close event - const previousStateObject = router.currentStateObject; - if (openModel) { - debugRouter('OPENING STATE', openModel); - router.currentStateObject = openModel; - if (previousStateObject === openModel) { - debugRouter('STATE IS SAME MODEL', openModel); - debugRouter('NAVSTATE REFRESH COMPONENT'); - await app.view.set('navState', false); - await app.view.set('navState', true); - return; - } - debugRouter('MODEL CLOSED STATE', openModel.closed); - if (openModel.closed || openModel.closed === undefined) { - debugRouter('MODEL CLOSED', openModel); - openModel.closed = false; - } - if (!openModel.panel) { - await router.closeState(previousStateObject); - } - } else { - debugRouter('CLOSE PREVIOUS PAGE COMPONENT NO CURRENT ONE GIVEN'); - router.currentStateObject = null; - await router.closeState(previousStateObject); - } - debugRouter('CURRENT STATE OBJECT HASH COMPONENT?'); - const currentStateObject = router.currentStateObject; - if (currentStateObject && currentStateObject.component) { - if (currentStateObject.open) { - debugRouter('MODEL OPEN STATE', router.currentStateObject); - currentStateObject.open(); - } - if (app.debug) { - debugRouter('NAVSTATE LOAD NEW COMPONENT'); - } - await Ractive.sharedSet('navState', false); - Ractive.components.navState = currentStateObject.component; - await Ractive.sharedSet('navState', true); - if (currentStateObject.watchers) { - currentStateObject.watchers.start(); - } - return; - } - }, - async pushState(url) { - if (url) { - router.saveState(); - router.setState(url, url); - router.updateLocation(); - await router.loadState(); - } - }, - reloadState(sourceState) { - const currentStateObject = sourceState || router.currentStateObject; - if (currentStateObject) { - if (currentStateObject.reload) { - batch(currentStateObject.reload); - } - } - }, - async routeChecker(data, reg) { - const matching = router.location.pathname.match(reg); - if (matching) { - router.match = matching; - const route = data.route(); - let routePath = (last(route.path) === '/') ? route.path : `${route.path}/`; - routePath = (routePath[0] === '/') ? routePath : `/${routePath}`; - route.path = routePath; - const routeRequire = data.require; - debugRouter('routeChecker MATCHED', routePath); - if (router.objectRoutes[routePath]) { - await router.go(router.objectRoutes[routePath]); - } else { - (async () => { - debugRouter('routeChecker ASYNC'); - if (!data.loaded && routeRequire) { - debugRouter('routeChecker demandJS'); - await demandJs(routeRequire); - } - const object = await demandJs(`routes${routePath}`); - if (!object) { - return; - } - const lang = await demandLang(routePath); - if (object.component && object.component.then) { - await object.component; - } - object.assets = object.assets || {}; - if (lang) { - object.assets.language = lang; - } - if (object.compile) { - await object.compile(); - } - router.objectRoutes[routePath] = object; - await router.go(object); - data.loaded = true; - })(); - } - } - return matching; - }, - routes: [], - saveState() { - assign(router.location.previous, omit(router.location, ['previous'])); - }, - setState(url, title, object) { - // pushState - if (hostname + url === hostname + window.location.pathname) { - router.reloadState(); - } else { - history.pushState(object, title, url); - } - }, - async setup() { - router.updateLocation(); - router.attachEvents(); - await router.loadState(); - }, - updateLocation() { - map(top.location, (item, index) => { - if (isString(item)) { - router.location[index] = item; - } - }); - router.location.pathScored = router.location.pathname.replace(/\//g, '_'); - router.location.paths = rest(router.location.pathname.split('/')); - router.location.pathCamel = camelCase(router.location.paths.join('_')); - Ractive.sharedSet('currentPath', router.location.pathname); - } -}); -Ractive.routerLoad = (componentView) => { - componentView.on({ - '*.routerBack'(eventArg) { - debugRouter('Router back State', eventArg); - router.historyIndex--; - Ractive.sharedSet('historyIndex', router.historyIndex); - debugRouter(router.historyIndex); - if (router.location.previous.hostname) { - window.history.back(); - } else { - return; - } - }, - '*.routerForward'(eventArg) { - debugRouter('Router forward State', eventArg); - if (router.location.previous.hostname) { - window.history.forward(); - } else { - return; - } - }, - '*.routerLoad'(eventArg) { - const href = eventArg.get('href'); - debugRouter('Router Load State', eventArg.get('href'), eventArg); - router.historyIndex++; - Ractive.sharedSet('historyIndex', router.historyIndex); - debugRouter(router.historyIndex); - if (href) { - router.pushState(href); - } else { - const node = eventArg.node; - const hrefAttribute = node.href || node.getAttribute('data-href'); - eventArg.original.preventDefault(); - router.pushState(hrefAttribute); - } - return false; - }, - }); -}; -assign(app, { - router, -}); diff --git a/uwBridge/system/compile/source/socket/security/index.js b/uwBridge/system/compile/source/socket/security/index.js deleted file mode 100644 index d673ca75..00000000 --- a/uwBridge/system/compile/source/socket/security/index.js +++ /dev/null @@ -1,8 +0,0 @@ -import app from '../app'; -const security = { - clear() { - console.log('Cleanup'); - } -}; -security.clear(); -app.security = security;