Skip to content

Commit

Permalink
core bundle updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sentivate committed Jan 21, 2022
1 parent 07dfbe0 commit f119b6a
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 96 deletions.
80 changes: 47 additions & 33 deletions uwBridge/system/compile/build/socket/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
let screenSize;
if (isAgent.mobile) {
screenSize = 'mobileScreen';
} else if (width < 690) {
} else if (width < 740) {
screenSize = 'tinyScreen';
} else if (width < 1024) {
screenSize = 'smallScreen';
Expand Down Expand Up @@ -303,12 +303,18 @@
};
const {
utility: {
each: each$6, isString: isString$3, isArray
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) => {
console.log(currentView, componentEvent, events);
console.log(args);
debugMultiEvent(currentView, componentEvent, events);
debugMultiEvent(args);
if (componentEvent && events.length) {
const {
original
Expand Down Expand Up @@ -396,7 +402,7 @@
const {
watch: watch$1,
utility: {
each: each$4, get, apply
each: each$4, get, apply: apply$1
}
} = app;
const createWatchers = (currentView, item, key) => {
Expand Down Expand Up @@ -484,15 +490,15 @@
const onConstruct = function(componentConfig) {
const sourceConstruct = componentConfig.onconstruct;
componentConfig.onconstruct = function(...args) {
apply(buildComponentEvents, this, [componentConfig, ...args]);
apply$1(buildComponentEvents, this, [componentConfig, ...args]);
if (sourceConstruct) {
return apply(sourceConstruct, this, args);
return apply$1(sourceConstruct, this, args);
}
};
const sourceRender = componentConfig.onrender;
componentConfig.onrender = function(...args) {
if (sourceRender) {
return apply(sourceRender, this, args);
return apply$1(sourceRender, this, args);
}
};
};
Expand Down Expand Up @@ -721,12 +727,18 @@
demandJs,
demandLang,
utility: {
cnsl, assign, each, map, isString, rest, camelCase, omit, last, batch, eventAdd
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, {
Expand All @@ -744,7 +756,7 @@
window,
'popstate',
async (eventArg) => {
console.log('popstate', eventArg);
debugRouter('popstate', eventArg);
router.saveState();
router.updateLocation();
await router.loadState();
Expand All @@ -754,24 +766,24 @@
);
},
async closeState(previousStateObject) {
console.log('closeState', previousStateObject);
debugRouter('closeState', previousStateObject);
if (previousStateObject) {
if (!previousStateObject.closed) {
console.log('forceClose', previousStateObject);
debugRouter('forceClose', previousStateObject);
return router.forceClose(previousStateObject);
}
return console.log('Previous State Marked As Closed', previousStateObject);
return debugRouter('Previous State Marked As Closed', previousStateObject);
}
},
async forceClose(sourceState) {
app.view.set('navState', false);
console.log('forceClose', sourceState);
debugRouter('forceClose', sourceState);
if (sourceState) {
if (sourceState.watchers) {
sourceState.watchers.stop();
}
if (sourceState.close) {
console.log('MODEL Close STATE', sourceState);
debugRouter('MODEL Close STATE', sourceState);
await sourceState.close();
}
sourceState.closed = true;
Expand Down Expand Up @@ -803,7 +815,7 @@
const result = Boolean(await item()) === false;
index++;
if (result === false) {
console.log('LOAD STATE', item, result);
debugRouter('LOAD STATE', item, result);
break;
}
}
Expand All @@ -816,36 +828,38 @@
// close event
const previousStateObject = router.currentStateObject;
if (openModel) {
console.log('OPENING STATE', openModel);
debugRouter('OPENING STATE', openModel);
router.currentStateObject = openModel;
if (previousStateObject === openModel) {
console.log('STATE IS SAME MODEL', openModel);
console.log('NAVSTATE REFRESH COMPONENT');
debugRouter('STATE IS SAME MODEL', openModel);
debugRouter('NAVSTATE REFRESH COMPONENT');
await app.view.set('navState', false);
await app.view.set('navState', true);
return;
}
console.log('MODEL CLOSED STATE', openModel.closed);
debugRouter('MODEL CLOSED STATE', openModel.closed);
if (openModel.closed || openModel.closed === undefined) {
console.log('MODEL CLOSED', openModel);
debugRouter('MODEL CLOSED', openModel);
openModel.closed = false;
}
if (!openModel.panel) {
await router.closeState(previousStateObject);
}
} else {
console.log('CLOSE PREVIOUS PAGE COMPONENT NO CURRENT ONE GIVEN');
debugRouter('CLOSE PREVIOUS PAGE COMPONENT NO CURRENT ONE GIVEN');
router.currentStateObject = null;
await router.closeState(previousStateObject);
}
console.log('CURRENT STATE OBJECT HASH COMPONENT?');
debugRouter('CURRENT STATE OBJECT HASH COMPONENT?');
const currentStateObject = router.currentStateObject;
if (currentStateObject && currentStateObject.component) {
if (currentStateObject.open) {
console.log('MODEL OPEN STATE', router.currentStateObject);
debugRouter('MODEL OPEN STATE', router.currentStateObject);
currentStateObject.open();
}
console.log('NAVSTATE LOAD NEW COMPONENT');
if (app.debug) {
debugRouter('NAVSTATE LOAD NEW COMPONENT');
}
await app.view.set('navState', false);
Ractive.components.navState = currentStateObject.component;
await app.view.set('navState', true);
Expand Down Expand Up @@ -880,14 +894,14 @@
routePath = routePath[0] === '/' ? routePath : `/${routePath}`;
route.path = routePath;
const routeRequire = data.require;
console.log('routeChecker MATCHED', routePath);
debugRouter('routeChecker MATCHED', routePath);
if (router.objectRoutes[routePath]) {
await router.go(router.objectRoutes[routePath]);
} else {
(async () => {
console.log('routeChecker ASYNC');
debugRouter('routeChecker ASYNC');
if (!data.loaded && routeRequire) {
console.log('routeChecker demandJS');
debugRouter('routeChecker demandJS');
await demandJs(routeRequire);
}
const object = await demandJs(`routes${routePath}`);
Expand Down Expand Up @@ -945,18 +959,18 @@
Ractive.routerLoad = (componentView) => {
componentView.on({
'*.routerBack'(eventArg) {
console.log('Router back State', eventArg);
debugRouter('Router back State', eventArg);
router.historyIndex--;
Ractive.sharedSet('historyIndex', router.historyIndex);
console.log(router.historyIndex);
debugRouter(router.historyIndex);
if (router.location.previous.hostname) {
window.history.back();
} else {
return;
}
},
'*.routerForward'(eventArg) {
console.log('Router forward State', eventArg);
debugRouter('Router forward State', eventArg);
if (router.location.previous.hostname) {
window.history.forward();
} else {
Expand All @@ -965,10 +979,10 @@
},
'*.routerLoad'(eventArg) {
const href = eventArg.get('href');
console.log('Router Load State', eventArg.get('href'), eventArg);
debugRouter('Router Load State', eventArg.get('href'), eventArg);
router.historyIndex++;
Ractive.sharedSet('historyIndex', router.historyIndex);
console.log(router.historyIndex);
debugRouter(router.historyIndex);
if (href) {
router.pushState(href);
} else {
Expand Down
Loading

0 comments on commit f119b6a

Please sign in to comment.