@xuda.io/runtime-bundle 1.0.720 → 1.0.721
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/js/xuda-runtime-bundle.js +47 -119
- package/js/xuda-runtime-bundle.min.js +2 -2
- package/js/xuda-runtime-slim.js +47 -119
- package/js/xuda-runtime-slim.min.es.js +47 -119
- package/js/xuda-runtime-slim.min.js +2 -2
- package/js/xuda-server-bundle.min.mjs +1 -1
- package/js/xuda-server-bundle.mjs +1 -1
- package/js/xuda-worker-bundle.js +1 -1
- package/js/xuda-worker-bundle.min.js +1 -1
- package/package.json +1 -1
package/js/xuda-runtime-slim.js
CHANGED
|
@@ -9401,7 +9401,7 @@ func.events.execute = async function (
|
|
|
9401
9401
|
var params_obj = {};
|
|
9402
9402
|
if (_prog?.properties?.progParams) {
|
|
9403
9403
|
for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
|
|
9404
|
-
if (val.data.dir
|
|
9404
|
+
if (!val.data.dir === 'in') continue;
|
|
9405
9405
|
if (typeof args.parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
|
|
9406
9406
|
if (args.parameters_obj_inP?.[val.data.parameter].fx) {
|
|
9407
9407
|
let ret = await func.expression.get(SESSION_ID, args.parameters_obj_inP?.[val.data.parameter].fx, dsSession, 'parameters');
|
|
@@ -15279,7 +15279,7 @@ func.UI.component.init_xu_nav = function ($container, $nav) {
|
|
|
15279
15279
|
func.UI.main = {};
|
|
15280
15280
|
|
|
15281
15281
|
func.UI.main.clear_SYNC_INTERVAL = function () {
|
|
15282
|
-
$(
|
|
15282
|
+
$('body').unbind('mousemove keypress mousedown');
|
|
15283
15283
|
};
|
|
15284
15284
|
func.UI.main.embed_prog_execute = async function (SESSION_ID, prog) {
|
|
15285
15285
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
@@ -15291,16 +15291,13 @@ func.UI.main.embed_prog_execute = async function (SESSION_ID, prog) {
|
|
|
15291
15291
|
var params_obj = {};
|
|
15292
15292
|
if (_prog?.properties?.progParams) {
|
|
15293
15293
|
for (const [key, val] of Object.entries(_prog.properties.progParams)) {
|
|
15294
|
-
if (
|
|
15295
|
-
if (typeof _session.url_params?.[val.data.parameter] !==
|
|
15296
|
-
params_obj[val.data.parameter] =
|
|
15297
|
-
_session.url_params?.[val.data.parameter];
|
|
15294
|
+
if (val.data.dir !== 'in') continue;
|
|
15295
|
+
if (typeof _session.url_params?.[val.data.parameter] !== 'undefined') {
|
|
15296
|
+
params_obj[val.data.parameter] = _session.url_params?.[val.data.parameter];
|
|
15298
15297
|
|
|
15299
15298
|
continue;
|
|
15300
15299
|
}
|
|
15301
|
-
console.warn(
|
|
15302
|
-
`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`
|
|
15303
|
-
);
|
|
15300
|
+
console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
|
|
15304
15301
|
}
|
|
15305
15302
|
}
|
|
15306
15303
|
return params_obj;
|
|
@@ -15308,50 +15305,33 @@ func.UI.main.embed_prog_execute = async function (SESSION_ID, prog) {
|
|
|
15308
15305
|
|
|
15309
15306
|
let screen_ret = await func.utils.get_screen_obj(SESSION_ID, prog);
|
|
15310
15307
|
if (screen_ret) {
|
|
15311
|
-
let ret_init = await func.UI.screen.init(
|
|
15312
|
-
SESSION_ID,
|
|
15313
|
-
prog,
|
|
15314
|
-
null,
|
|
15315
|
-
null,
|
|
15316
|
-
$("#embed_" + SESSION_ID),
|
|
15317
|
-
null,
|
|
15318
|
-
null,
|
|
15319
|
-
null,
|
|
15320
|
-
null,
|
|
15321
|
-
get_params_obj(),
|
|
15322
|
-
"call_embed"
|
|
15323
|
-
);
|
|
15308
|
+
let ret_init = await func.UI.screen.init(SESSION_ID, prog, null, null, $('#embed_' + SESSION_ID), null, null, null, null, get_params_obj(), 'call_embed');
|
|
15324
15309
|
document.title = screen_ret.properties.menuTitle;
|
|
15325
15310
|
|
|
15326
15311
|
return;
|
|
15327
15312
|
}
|
|
15328
15313
|
|
|
15329
|
-
console.error(
|
|
15330
|
-
func.UI.utils.progressScreen.show(
|
|
15331
|
-
SESSION_ID,
|
|
15332
|
-
"Program not exist",
|
|
15333
|
-
null,
|
|
15334
|
-
true
|
|
15335
|
-
);
|
|
15314
|
+
console.error('Program not exist', prog);
|
|
15315
|
+
func.UI.utils.progressScreen.show(SESSION_ID, 'Program not exist', null, true);
|
|
15336
15316
|
// }
|
|
15337
15317
|
};
|
|
15338
15318
|
|
|
15339
15319
|
func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
15340
15320
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
15341
|
-
var hash =
|
|
15321
|
+
var hash = '';
|
|
15342
15322
|
if (window.location.hash) hash = window.location.hash.substr(1);
|
|
15343
15323
|
_session.SYS_GLOBAL_STR_BROWSER_HASH_ID = hash;
|
|
15344
15324
|
_session.SYS_GLOBAL_STR_BROWSER_TITLE = document.title;
|
|
15345
15325
|
|
|
15346
15326
|
const init_system_ds = async function () {
|
|
15347
|
-
if (![
|
|
15348
|
-
await func.index.new_webworker(SESSION_ID, { menuName:
|
|
15327
|
+
if (!['main'].includes(_session.opt.app_computing_mode)) {
|
|
15328
|
+
await func.index.new_webworker(SESSION_ID, { menuName: 'Main' });
|
|
15349
15329
|
// await func.index.call_worker(SESSION_ID, {
|
|
15350
15330
|
// service: "create_webworker_globals",
|
|
15351
15331
|
// data: { ds_data: _session.DS_GLB[0], session_id: SESSION_ID },
|
|
15352
15332
|
// });
|
|
15353
15333
|
}
|
|
15354
|
-
const ret = await func.datasource.create(SESSION_ID,
|
|
15334
|
+
const ret = await func.datasource.create(SESSION_ID, 'system');
|
|
15355
15335
|
|
|
15356
15336
|
/////////// moved to the datasource callback to allow sync on_load events to run at worker
|
|
15357
15337
|
|
|
@@ -15367,12 +15347,7 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15367
15347
|
};
|
|
15368
15348
|
const set_SYS_GLOBAL_KEYS_STATE = async function (SESSION_ID, e, state) {
|
|
15369
15349
|
if (!_session?.DS_GLB?.[0]) return;
|
|
15370
|
-
if (
|
|
15371
|
-
e.keyCode !== 16 &&
|
|
15372
|
-
e.keyCode !== 17 &&
|
|
15373
|
-
e.keyCode !== 18 &&
|
|
15374
|
-
e.keyCode !== 91
|
|
15375
|
-
) {
|
|
15350
|
+
if (e.keyCode !== 16 && e.keyCode !== 17 && e.keyCode !== 18 && e.keyCode !== 91) {
|
|
15376
15351
|
return;
|
|
15377
15352
|
}
|
|
15378
15353
|
|
|
@@ -15393,7 +15368,7 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15393
15368
|
|
|
15394
15369
|
var datasource_changes = {
|
|
15395
15370
|
[0]: {
|
|
15396
|
-
[
|
|
15371
|
+
['data_system']: data,
|
|
15397
15372
|
},
|
|
15398
15373
|
};
|
|
15399
15374
|
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
@@ -15404,38 +15379,32 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15404
15379
|
_session.WORKER_OBJ.fx.init();
|
|
15405
15380
|
};
|
|
15406
15381
|
const create_embed_container = async function () {
|
|
15407
|
-
$(
|
|
15408
|
-
.attr(
|
|
15382
|
+
$('<div>')
|
|
15383
|
+
.attr('id', 'embed_' + SESSION_ID)
|
|
15409
15384
|
|
|
15410
|
-
.addClass(
|
|
15385
|
+
.addClass('xu_embed_div')
|
|
15411
15386
|
.data({ xuData: {} })
|
|
15412
15387
|
.appendTo($(_session.root_element));
|
|
15413
15388
|
};
|
|
15414
15389
|
const execute_PENDING_OPEN_URL_EVENTS = async function () {
|
|
15415
|
-
if (
|
|
15416
|
-
typeof func.events.execute_PENDING_OPEN_URL_EVENTS !== "undefined" &&
|
|
15417
|
-
glb.is_cordova
|
|
15418
|
-
) {
|
|
15390
|
+
if (typeof func.events.execute_PENDING_OPEN_URL_EVENTS !== 'undefined' && glb.is_cordova) {
|
|
15419
15391
|
func.events.execute_PENDING_OPEN_URL_EVENTS();
|
|
15420
15392
|
}
|
|
15421
15393
|
};
|
|
15422
15394
|
|
|
15423
15395
|
const remove_loader = async function () {
|
|
15424
|
-
$(
|
|
15425
|
-
$(_session.root_element).removeClass(
|
|
15396
|
+
$('.loader').remove();
|
|
15397
|
+
$(_session.root_element).removeClass('loader_background_color');
|
|
15426
15398
|
};
|
|
15427
15399
|
const perform_callback = async function () {
|
|
15428
15400
|
if (_session.api_callback) {
|
|
15429
|
-
_session.api_callback(
|
|
15401
|
+
_session.api_callback('xuda_ready', SESSION_ID, SESSION_OBJ);
|
|
15430
15402
|
}
|
|
15431
15403
|
};
|
|
15432
15404
|
|
|
15433
15405
|
const call_program = async function () {
|
|
15434
15406
|
if (_session.route_id) {
|
|
15435
|
-
const route_obj = await func.utils.DOCS_OBJ.get(
|
|
15436
|
-
SESSION_ID,
|
|
15437
|
-
_session.route_id
|
|
15438
|
-
);
|
|
15407
|
+
const route_obj = await func.utils.DOCS_OBJ.get(SESSION_ID, _session.route_id);
|
|
15439
15408
|
|
|
15440
15409
|
function flattenMenuItems(menu) {
|
|
15441
15410
|
let flatMenu = {};
|
|
@@ -15478,50 +15447,25 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15478
15447
|
if (!_session.prog_id) return;
|
|
15479
15448
|
|
|
15480
15449
|
await func.utils.TREE_OBJ.get(SESSION_ID, _session.prog_id);
|
|
15481
|
-
let screen_ret = await func.utils.get_screen_obj(
|
|
15482
|
-
SESSION_ID,
|
|
15483
|
-
_session.prog_id
|
|
15484
|
-
);
|
|
15450
|
+
let screen_ret = await func.utils.get_screen_obj(SESSION_ID, _session.prog_id);
|
|
15485
15451
|
if (screen_ret) {
|
|
15486
15452
|
func.UI.main.embed_prog_execute(SESSION_ID, _session.prog_id);
|
|
15487
15453
|
} else {
|
|
15488
|
-
console.error(
|
|
15489
|
-
func.UI.utils.progressScreen.show(
|
|
15490
|
-
SESSION_ID,
|
|
15491
|
-
"Program not exist",
|
|
15492
|
-
null,
|
|
15493
|
-
true
|
|
15494
|
-
);
|
|
15454
|
+
console.error('Program not exist', _session.prog_id);
|
|
15455
|
+
func.UI.utils.progressScreen.show(SESSION_ID, 'Program not exist', null, true);
|
|
15495
15456
|
}
|
|
15496
15457
|
};
|
|
15497
15458
|
|
|
15498
15459
|
const register_run_background_plugins = async function () {
|
|
15499
|
-
if (typeof glb.SLIM_BUNDLE !==
|
|
15460
|
+
if (typeof glb.SLIM_BUNDLE !== 'undefined' || glb.SLIM_BUNDLE) return;
|
|
15500
15461
|
|
|
15501
|
-
for await (const [plugin_name, val] of Object.entries(
|
|
15502
|
-
|
|
15503
|
-
)) {
|
|
15504
|
-
if (
|
|
15505
|
-
val.installed &&
|
|
15506
|
-
val.run_in_background &&
|
|
15507
|
-
val.manifest?.["runtime.mjs"]?.exist
|
|
15508
|
-
) {
|
|
15462
|
+
for await (const [plugin_name, val] of Object.entries(APP_OBJ[_session.app_id].app_plugins_purchased)) {
|
|
15463
|
+
if (val.installed && val.run_in_background && val.manifest?.['runtime.mjs']?.exist) {
|
|
15509
15464
|
try {
|
|
15510
|
-
const plugin_runtime_src = await func.utils.get_plugin_npm_cdn(
|
|
15511
|
-
SESSION_ID,
|
|
15512
|
-
plugin_name,
|
|
15513
|
-
`${val.manifest["runtime.mjs"].dist ? "dist/" : ""}runtime.mjs`
|
|
15514
|
-
);
|
|
15465
|
+
const plugin_runtime_src = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, `${val.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`);
|
|
15515
15466
|
|
|
15516
|
-
if (
|
|
15517
|
-
|
|
15518
|
-
val.manifest?.["runtime.mjs"]?.css
|
|
15519
|
-
) {
|
|
15520
|
-
const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(
|
|
15521
|
-
SESSION_ID,
|
|
15522
|
-
plugin_name,
|
|
15523
|
-
"dist/runtime.css"
|
|
15524
|
-
);
|
|
15467
|
+
if (val.manifest['runtime.mjs'].dist && val.manifest?.['runtime.mjs']?.css) {
|
|
15468
|
+
const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, 'dist/runtime.css');
|
|
15525
15469
|
func.utils.load_css_on_demand(plugin_runtime_css_url);
|
|
15526
15470
|
}
|
|
15527
15471
|
|
|
@@ -15529,20 +15473,13 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15529
15473
|
eval(plugin_script);
|
|
15530
15474
|
|
|
15531
15475
|
let plugin_setup_script_ret = null;
|
|
15532
|
-
if (val.manifest?.[
|
|
15533
|
-
const plugin_setup_src = await func.utils.get_plugin_npm_cdn(
|
|
15534
|
-
SESSION_ID,
|
|
15535
|
-
plugin_name,
|
|
15536
|
-
`${val.manifest["index.mjs"].dist ? "dist/" : ""}index.mjs`
|
|
15537
|
-
);
|
|
15476
|
+
if (val.manifest?.['index.mjs']?.exist) {
|
|
15477
|
+
const plugin_setup_src = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, `${val.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
|
|
15538
15478
|
|
|
15539
15479
|
let plugin_setup_script = await import(plugin_setup_src);
|
|
15540
15480
|
|
|
15541
15481
|
if (plugin_setup_script) {
|
|
15542
|
-
plugin_setup_script_ret = await func.utils.get_plugin_setup(
|
|
15543
|
-
SESSION_ID,
|
|
15544
|
-
plugin_name
|
|
15545
|
-
);
|
|
15482
|
+
plugin_setup_script_ret = await func.utils.get_plugin_setup(SESSION_ID, plugin_name);
|
|
15546
15483
|
if (plugin_setup_script_ret.code < 0) {
|
|
15547
15484
|
throw plugin_setup_script_ret;
|
|
15548
15485
|
}
|
|
@@ -15569,7 +15506,7 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15569
15506
|
|
|
15570
15507
|
var datasource_changes = {
|
|
15571
15508
|
[0]: {
|
|
15572
|
-
[
|
|
15509
|
+
['data_system']: data,
|
|
15573
15510
|
},
|
|
15574
15511
|
};
|
|
15575
15512
|
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
@@ -15579,20 +15516,20 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15579
15516
|
|
|
15580
15517
|
$(_session.root_element).show();
|
|
15581
15518
|
func.UI.component.create_app_root_component(SESSION_ID);
|
|
15582
|
-
await glb.lifecycle.execute(SESSION_ID,
|
|
15519
|
+
await glb.lifecycle.execute(SESSION_ID, 'beforeInit');
|
|
15583
15520
|
await start_workers();
|
|
15584
15521
|
await init_system_ds();
|
|
15585
|
-
await glb.lifecycle.execute(SESSION_ID,
|
|
15522
|
+
await glb.lifecycle.execute(SESSION_ID, 'initialized');
|
|
15586
15523
|
await create_embed_container();
|
|
15587
15524
|
await execute_PENDING_OPEN_URL_EVENTS();
|
|
15588
15525
|
await remove_loader();
|
|
15589
15526
|
await func.UI.worker.init(SESSION_ID);
|
|
15590
|
-
await glb.lifecycle.execute(SESSION_ID,
|
|
15527
|
+
await glb.lifecycle.execute(SESSION_ID, 'beforeMounted');
|
|
15591
15528
|
await call_program();
|
|
15592
|
-
await glb.lifecycle.execute(SESSION_ID,
|
|
15529
|
+
await glb.lifecycle.execute(SESSION_ID, 'mounted');
|
|
15593
15530
|
await perform_callback();
|
|
15594
|
-
func.utils.debug.write(SESSION_ID,
|
|
15595
|
-
await glb.lifecycle.execute(SESSION_ID,
|
|
15531
|
+
func.utils.debug.write(SESSION_ID, 'Xuda.io started.');
|
|
15532
|
+
await glb.lifecycle.execute(SESSION_ID, 'systemReady');
|
|
15596
15533
|
/////////////////////////////
|
|
15597
15534
|
$(document).keydown(function (e) {
|
|
15598
15535
|
set_SYS_GLOBAL_KEYS_STATE(SESSION_ID, e, 1);
|
|
@@ -15602,23 +15539,14 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15602
15539
|
});
|
|
15603
15540
|
|
|
15604
15541
|
await updateOnlineStatus();
|
|
15605
|
-
window.addEventListener(
|
|
15606
|
-
window.addEventListener(
|
|
15542
|
+
window.addEventListener('online', updateOnlineStatus);
|
|
15543
|
+
window.addEventListener('offline', updateOnlineStatus);
|
|
15607
15544
|
|
|
15608
|
-
console.log(
|
|
15609
|
-
$(
|
|
15545
|
+
console.log('xuda.io system ready.');
|
|
15546
|
+
$('body')[0].dispatchEvent(glb.system_ready_event);
|
|
15610
15547
|
};
|
|
15611
15548
|
func.UI.main.set_custom_css = function (SESSION_ID, callbackP) {
|
|
15612
|
-
if (
|
|
15613
|
-
SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system?.["SYS_GLOBAL_STR_SITE_CSS"]
|
|
15614
|
-
)
|
|
15615
|
-
$(
|
|
15616
|
-
"<style type='text/css'> " +
|
|
15617
|
-
SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system[
|
|
15618
|
-
"SYS_GLOBAL_STR_SITE_CSS"
|
|
15619
|
-
] +
|
|
15620
|
-
" </style>"
|
|
15621
|
-
).appendTo("head");
|
|
15549
|
+
if (SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system?.['SYS_GLOBAL_STR_SITE_CSS']) $("<style type='text/css'> " + SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system['SYS_GLOBAL_STR_SITE_CSS'] + ' </style>').appendTo('head');
|
|
15622
15550
|
callbackP();
|
|
15623
15551
|
};
|
|
15624
15552
|
func.index = {};
|
|
@@ -13490,7 +13490,7 @@ func.events.execute = async function (
|
|
|
13490
13490
|
var params_obj = {};
|
|
13491
13491
|
if (_prog?.properties?.progParams) {
|
|
13492
13492
|
for await (const [key, val] of Object.entries(_prog.properties.progParams)) {
|
|
13493
|
-
if (val.data.dir
|
|
13493
|
+
if (!val.data.dir === 'in') continue;
|
|
13494
13494
|
if (typeof args.parameters_obj_inP?.[val.data.parameter] !== 'undefined') {
|
|
13495
13495
|
if (args.parameters_obj_inP?.[val.data.parameter].fx) {
|
|
13496
13496
|
let ret = await func.expression.get(SESSION_ID, args.parameters_obj_inP?.[val.data.parameter].fx, dsSession, 'parameters');
|
|
@@ -15280,7 +15280,7 @@ func.expression.secure_eval = async function (SESSION_ID, sourceP, val, job_id,
|
|
|
15280
15280
|
func.UI.main = {};
|
|
15281
15281
|
|
|
15282
15282
|
func.UI.main.clear_SYNC_INTERVAL = function () {
|
|
15283
|
-
$(
|
|
15283
|
+
$('body').unbind('mousemove keypress mousedown');
|
|
15284
15284
|
};
|
|
15285
15285
|
func.UI.main.embed_prog_execute = async function (SESSION_ID, prog) {
|
|
15286
15286
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
@@ -15292,16 +15292,13 @@ func.UI.main.embed_prog_execute = async function (SESSION_ID, prog) {
|
|
|
15292
15292
|
var params_obj = {};
|
|
15293
15293
|
if (_prog?.properties?.progParams) {
|
|
15294
15294
|
for (const [key, val] of Object.entries(_prog.properties.progParams)) {
|
|
15295
|
-
if (
|
|
15296
|
-
if (typeof _session.url_params?.[val.data.parameter] !==
|
|
15297
|
-
params_obj[val.data.parameter] =
|
|
15298
|
-
_session.url_params?.[val.data.parameter];
|
|
15295
|
+
if (val.data.dir !== 'in') continue;
|
|
15296
|
+
if (typeof _session.url_params?.[val.data.parameter] !== 'undefined') {
|
|
15297
|
+
params_obj[val.data.parameter] = _session.url_params?.[val.data.parameter];
|
|
15299
15298
|
|
|
15300
15299
|
continue;
|
|
15301
15300
|
}
|
|
15302
|
-
console.warn(
|
|
15303
|
-
`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`
|
|
15304
|
-
);
|
|
15301
|
+
console.warn(`Warning: Program ${_prog.properties.menuName} expected In parameter: ${val.data.parameter} but received null instead`);
|
|
15305
15302
|
}
|
|
15306
15303
|
}
|
|
15307
15304
|
return params_obj;
|
|
@@ -15309,50 +15306,33 @@ func.UI.main.embed_prog_execute = async function (SESSION_ID, prog) {
|
|
|
15309
15306
|
|
|
15310
15307
|
let screen_ret = await func.utils.get_screen_obj(SESSION_ID, prog);
|
|
15311
15308
|
if (screen_ret) {
|
|
15312
|
-
let ret_init = await func.UI.screen.init(
|
|
15313
|
-
SESSION_ID,
|
|
15314
|
-
prog,
|
|
15315
|
-
null,
|
|
15316
|
-
null,
|
|
15317
|
-
$("#embed_" + SESSION_ID),
|
|
15318
|
-
null,
|
|
15319
|
-
null,
|
|
15320
|
-
null,
|
|
15321
|
-
null,
|
|
15322
|
-
get_params_obj(),
|
|
15323
|
-
"call_embed"
|
|
15324
|
-
);
|
|
15309
|
+
let ret_init = await func.UI.screen.init(SESSION_ID, prog, null, null, $('#embed_' + SESSION_ID), null, null, null, null, get_params_obj(), 'call_embed');
|
|
15325
15310
|
document.title = screen_ret.properties.menuTitle;
|
|
15326
15311
|
|
|
15327
15312
|
return;
|
|
15328
15313
|
}
|
|
15329
15314
|
|
|
15330
|
-
console.error(
|
|
15331
|
-
func.UI.utils.progressScreen.show(
|
|
15332
|
-
SESSION_ID,
|
|
15333
|
-
"Program not exist",
|
|
15334
|
-
null,
|
|
15335
|
-
true
|
|
15336
|
-
);
|
|
15315
|
+
console.error('Program not exist', prog);
|
|
15316
|
+
func.UI.utils.progressScreen.show(SESSION_ID, 'Program not exist', null, true);
|
|
15337
15317
|
// }
|
|
15338
15318
|
};
|
|
15339
15319
|
|
|
15340
15320
|
func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
15341
15321
|
var _session = SESSION_OBJ[SESSION_ID];
|
|
15342
|
-
var hash =
|
|
15322
|
+
var hash = '';
|
|
15343
15323
|
if (window.location.hash) hash = window.location.hash.substr(1);
|
|
15344
15324
|
_session.SYS_GLOBAL_STR_BROWSER_HASH_ID = hash;
|
|
15345
15325
|
_session.SYS_GLOBAL_STR_BROWSER_TITLE = document.title;
|
|
15346
15326
|
|
|
15347
15327
|
const init_system_ds = async function () {
|
|
15348
|
-
if (![
|
|
15349
|
-
await func.index.new_webworker(SESSION_ID, { menuName:
|
|
15328
|
+
if (!['main'].includes(_session.opt.app_computing_mode)) {
|
|
15329
|
+
await func.index.new_webworker(SESSION_ID, { menuName: 'Main' });
|
|
15350
15330
|
// await func.index.call_worker(SESSION_ID, {
|
|
15351
15331
|
// service: "create_webworker_globals",
|
|
15352
15332
|
// data: { ds_data: _session.DS_GLB[0], session_id: SESSION_ID },
|
|
15353
15333
|
// });
|
|
15354
15334
|
}
|
|
15355
|
-
const ret = await func.datasource.create(SESSION_ID,
|
|
15335
|
+
const ret = await func.datasource.create(SESSION_ID, 'system');
|
|
15356
15336
|
|
|
15357
15337
|
/////////// moved to the datasource callback to allow sync on_load events to run at worker
|
|
15358
15338
|
|
|
@@ -15368,12 +15348,7 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15368
15348
|
};
|
|
15369
15349
|
const set_SYS_GLOBAL_KEYS_STATE = async function (SESSION_ID, e, state) {
|
|
15370
15350
|
if (!_session?.DS_GLB?.[0]) return;
|
|
15371
|
-
if (
|
|
15372
|
-
e.keyCode !== 16 &&
|
|
15373
|
-
e.keyCode !== 17 &&
|
|
15374
|
-
e.keyCode !== 18 &&
|
|
15375
|
-
e.keyCode !== 91
|
|
15376
|
-
) {
|
|
15351
|
+
if (e.keyCode !== 16 && e.keyCode !== 17 && e.keyCode !== 18 && e.keyCode !== 91) {
|
|
15377
15352
|
return;
|
|
15378
15353
|
}
|
|
15379
15354
|
|
|
@@ -15394,7 +15369,7 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15394
15369
|
|
|
15395
15370
|
var datasource_changes = {
|
|
15396
15371
|
[0]: {
|
|
15397
|
-
[
|
|
15372
|
+
['data_system']: data,
|
|
15398
15373
|
},
|
|
15399
15374
|
};
|
|
15400
15375
|
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
@@ -15405,38 +15380,32 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15405
15380
|
_session.WORKER_OBJ.fx.init();
|
|
15406
15381
|
};
|
|
15407
15382
|
const create_embed_container = async function () {
|
|
15408
|
-
$(
|
|
15409
|
-
.attr(
|
|
15383
|
+
$('<div>')
|
|
15384
|
+
.attr('id', 'embed_' + SESSION_ID)
|
|
15410
15385
|
|
|
15411
|
-
.addClass(
|
|
15386
|
+
.addClass('xu_embed_div')
|
|
15412
15387
|
.data({ xuData: {} })
|
|
15413
15388
|
.appendTo($(_session.root_element));
|
|
15414
15389
|
};
|
|
15415
15390
|
const execute_PENDING_OPEN_URL_EVENTS = async function () {
|
|
15416
|
-
if (
|
|
15417
|
-
typeof func.events.execute_PENDING_OPEN_URL_EVENTS !== "undefined" &&
|
|
15418
|
-
glb.is_cordova
|
|
15419
|
-
) {
|
|
15391
|
+
if (typeof func.events.execute_PENDING_OPEN_URL_EVENTS !== 'undefined' && glb.is_cordova) {
|
|
15420
15392
|
func.events.execute_PENDING_OPEN_URL_EVENTS();
|
|
15421
15393
|
}
|
|
15422
15394
|
};
|
|
15423
15395
|
|
|
15424
15396
|
const remove_loader = async function () {
|
|
15425
|
-
$(
|
|
15426
|
-
$(_session.root_element).removeClass(
|
|
15397
|
+
$('.loader').remove();
|
|
15398
|
+
$(_session.root_element).removeClass('loader_background_color');
|
|
15427
15399
|
};
|
|
15428
15400
|
const perform_callback = async function () {
|
|
15429
15401
|
if (_session.api_callback) {
|
|
15430
|
-
_session.api_callback(
|
|
15402
|
+
_session.api_callback('xuda_ready', SESSION_ID, SESSION_OBJ);
|
|
15431
15403
|
}
|
|
15432
15404
|
};
|
|
15433
15405
|
|
|
15434
15406
|
const call_program = async function () {
|
|
15435
15407
|
if (_session.route_id) {
|
|
15436
|
-
const route_obj = await func.utils.DOCS_OBJ.get(
|
|
15437
|
-
SESSION_ID,
|
|
15438
|
-
_session.route_id
|
|
15439
|
-
);
|
|
15408
|
+
const route_obj = await func.utils.DOCS_OBJ.get(SESSION_ID, _session.route_id);
|
|
15440
15409
|
|
|
15441
15410
|
function flattenMenuItems(menu) {
|
|
15442
15411
|
let flatMenu = {};
|
|
@@ -15479,50 +15448,25 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15479
15448
|
if (!_session.prog_id) return;
|
|
15480
15449
|
|
|
15481
15450
|
await func.utils.TREE_OBJ.get(SESSION_ID, _session.prog_id);
|
|
15482
|
-
let screen_ret = await func.utils.get_screen_obj(
|
|
15483
|
-
SESSION_ID,
|
|
15484
|
-
_session.prog_id
|
|
15485
|
-
);
|
|
15451
|
+
let screen_ret = await func.utils.get_screen_obj(SESSION_ID, _session.prog_id);
|
|
15486
15452
|
if (screen_ret) {
|
|
15487
15453
|
func.UI.main.embed_prog_execute(SESSION_ID, _session.prog_id);
|
|
15488
15454
|
} else {
|
|
15489
|
-
console.error(
|
|
15490
|
-
func.UI.utils.progressScreen.show(
|
|
15491
|
-
SESSION_ID,
|
|
15492
|
-
"Program not exist",
|
|
15493
|
-
null,
|
|
15494
|
-
true
|
|
15495
|
-
);
|
|
15455
|
+
console.error('Program not exist', _session.prog_id);
|
|
15456
|
+
func.UI.utils.progressScreen.show(SESSION_ID, 'Program not exist', null, true);
|
|
15496
15457
|
}
|
|
15497
15458
|
};
|
|
15498
15459
|
|
|
15499
15460
|
const register_run_background_plugins = async function () {
|
|
15500
|
-
if (typeof glb.SLIM_BUNDLE !==
|
|
15461
|
+
if (typeof glb.SLIM_BUNDLE !== 'undefined' || glb.SLIM_BUNDLE) return;
|
|
15501
15462
|
|
|
15502
|
-
for await (const [plugin_name, val] of Object.entries(
|
|
15503
|
-
|
|
15504
|
-
)) {
|
|
15505
|
-
if (
|
|
15506
|
-
val.installed &&
|
|
15507
|
-
val.run_in_background &&
|
|
15508
|
-
val.manifest?.["runtime.mjs"]?.exist
|
|
15509
|
-
) {
|
|
15463
|
+
for await (const [plugin_name, val] of Object.entries(APP_OBJ[_session.app_id].app_plugins_purchased)) {
|
|
15464
|
+
if (val.installed && val.run_in_background && val.manifest?.['runtime.mjs']?.exist) {
|
|
15510
15465
|
try {
|
|
15511
|
-
const plugin_runtime_src = await func.utils.get_plugin_npm_cdn(
|
|
15512
|
-
SESSION_ID,
|
|
15513
|
-
plugin_name,
|
|
15514
|
-
`${val.manifest["runtime.mjs"].dist ? "dist/" : ""}runtime.mjs`
|
|
15515
|
-
);
|
|
15466
|
+
const plugin_runtime_src = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, `${val.manifest['runtime.mjs'].dist ? 'dist/' : ''}runtime.mjs`);
|
|
15516
15467
|
|
|
15517
|
-
if (
|
|
15518
|
-
|
|
15519
|
-
val.manifest?.["runtime.mjs"]?.css
|
|
15520
|
-
) {
|
|
15521
|
-
const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(
|
|
15522
|
-
SESSION_ID,
|
|
15523
|
-
plugin_name,
|
|
15524
|
-
"dist/runtime.css"
|
|
15525
|
-
);
|
|
15468
|
+
if (val.manifest['runtime.mjs'].dist && val.manifest?.['runtime.mjs']?.css) {
|
|
15469
|
+
const plugin_runtime_css_url = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, 'dist/runtime.css');
|
|
15526
15470
|
func.utils.load_css_on_demand(plugin_runtime_css_url);
|
|
15527
15471
|
}
|
|
15528
15472
|
|
|
@@ -15530,20 +15474,13 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15530
15474
|
eval(plugin_script);
|
|
15531
15475
|
|
|
15532
15476
|
let plugin_setup_script_ret = null;
|
|
15533
|
-
if (val.manifest?.[
|
|
15534
|
-
const plugin_setup_src = await func.utils.get_plugin_npm_cdn(
|
|
15535
|
-
SESSION_ID,
|
|
15536
|
-
plugin_name,
|
|
15537
|
-
`${val.manifest["index.mjs"].dist ? "dist/" : ""}index.mjs`
|
|
15538
|
-
);
|
|
15477
|
+
if (val.manifest?.['index.mjs']?.exist) {
|
|
15478
|
+
const plugin_setup_src = await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, `${val.manifest['index.mjs'].dist ? 'dist/' : ''}index.mjs`);
|
|
15539
15479
|
|
|
15540
15480
|
let plugin_setup_script = await import(plugin_setup_src);
|
|
15541
15481
|
|
|
15542
15482
|
if (plugin_setup_script) {
|
|
15543
|
-
plugin_setup_script_ret = await func.utils.get_plugin_setup(
|
|
15544
|
-
SESSION_ID,
|
|
15545
|
-
plugin_name
|
|
15546
|
-
);
|
|
15483
|
+
plugin_setup_script_ret = await func.utils.get_plugin_setup(SESSION_ID, plugin_name);
|
|
15547
15484
|
if (plugin_setup_script_ret.code < 0) {
|
|
15548
15485
|
throw plugin_setup_script_ret;
|
|
15549
15486
|
}
|
|
@@ -15570,7 +15507,7 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15570
15507
|
|
|
15571
15508
|
var datasource_changes = {
|
|
15572
15509
|
[0]: {
|
|
15573
|
-
[
|
|
15510
|
+
['data_system']: data,
|
|
15574
15511
|
},
|
|
15575
15512
|
};
|
|
15576
15513
|
await func.datasource.update(SESSION_ID, datasource_changes);
|
|
@@ -15580,20 +15517,20 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15580
15517
|
|
|
15581
15518
|
$(_session.root_element).show();
|
|
15582
15519
|
func.UI.component.create_app_root_component(SESSION_ID);
|
|
15583
|
-
await glb.lifecycle.execute(SESSION_ID,
|
|
15520
|
+
await glb.lifecycle.execute(SESSION_ID, 'beforeInit');
|
|
15584
15521
|
await start_workers();
|
|
15585
15522
|
await init_system_ds();
|
|
15586
|
-
await glb.lifecycle.execute(SESSION_ID,
|
|
15523
|
+
await glb.lifecycle.execute(SESSION_ID, 'initialized');
|
|
15587
15524
|
await create_embed_container();
|
|
15588
15525
|
await execute_PENDING_OPEN_URL_EVENTS();
|
|
15589
15526
|
await remove_loader();
|
|
15590
15527
|
await func.UI.worker.init(SESSION_ID);
|
|
15591
|
-
await glb.lifecycle.execute(SESSION_ID,
|
|
15528
|
+
await glb.lifecycle.execute(SESSION_ID, 'beforeMounted');
|
|
15592
15529
|
await call_program();
|
|
15593
|
-
await glb.lifecycle.execute(SESSION_ID,
|
|
15530
|
+
await glb.lifecycle.execute(SESSION_ID, 'mounted');
|
|
15594
15531
|
await perform_callback();
|
|
15595
|
-
func.utils.debug.write(SESSION_ID,
|
|
15596
|
-
await glb.lifecycle.execute(SESSION_ID,
|
|
15532
|
+
func.utils.debug.write(SESSION_ID, 'Xuda.io started.');
|
|
15533
|
+
await glb.lifecycle.execute(SESSION_ID, 'systemReady');
|
|
15597
15534
|
/////////////////////////////
|
|
15598
15535
|
$(document).keydown(function (e) {
|
|
15599
15536
|
set_SYS_GLOBAL_KEYS_STATE(SESSION_ID, e, 1);
|
|
@@ -15603,23 +15540,14 @@ func.UI.main.embed_loader = async function (SESSION_ID) {
|
|
|
15603
15540
|
});
|
|
15604
15541
|
|
|
15605
15542
|
await updateOnlineStatus();
|
|
15606
|
-
window.addEventListener(
|
|
15607
|
-
window.addEventListener(
|
|
15543
|
+
window.addEventListener('online', updateOnlineStatus);
|
|
15544
|
+
window.addEventListener('offline', updateOnlineStatus);
|
|
15608
15545
|
|
|
15609
|
-
console.log(
|
|
15610
|
-
$(
|
|
15546
|
+
console.log('xuda.io system ready.');
|
|
15547
|
+
$('body')[0].dispatchEvent(glb.system_ready_event);
|
|
15611
15548
|
};
|
|
15612
15549
|
func.UI.main.set_custom_css = function (SESSION_ID, callbackP) {
|
|
15613
|
-
if (
|
|
15614
|
-
SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system?.["SYS_GLOBAL_STR_SITE_CSS"]
|
|
15615
|
-
)
|
|
15616
|
-
$(
|
|
15617
|
-
"<style type='text/css'> " +
|
|
15618
|
-
SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system[
|
|
15619
|
-
"SYS_GLOBAL_STR_SITE_CSS"
|
|
15620
|
-
] +
|
|
15621
|
-
" </style>"
|
|
15622
|
-
).appendTo("head");
|
|
15550
|
+
if (SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system?.['SYS_GLOBAL_STR_SITE_CSS']) $("<style type='text/css'> " + SESSION_OBJ[SESSION_ID].DS_GLB[0].data_system['SYS_GLOBAL_STR_SITE_CSS'] + ' </style>').appendTo('head');
|
|
15623
15551
|
callbackP();
|
|
15624
15552
|
};
|
|
15625
15553
|
func.index = {};
|