@xuda.io/runtime-bundle 1.0.858 → 1.0.860

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.
@@ -24718,7 +24718,7 @@ var SCREEN_BLOCKER_OBJ = {};
24718
24718
  var IS_PROGRESS_SCREEN_OPEN = null;
24719
24719
  // var UI_ENGINE_OBJ = null;
24720
24720
 
24721
- var UI_WORKER_OBJ = { jobs: [], num: 9000, cache: {}, viewport_info: {} };
24721
+ var UI_WORKER_OBJ = { jobs: [], num: 9000, cache: {}, viewport_height_set_ids: [], pending_for_viewport_render: {} };
24722
24722
 
24723
24723
  glb.html5_events_handler = [
24724
24724
  'onabort',
@@ -27853,13 +27853,16 @@ func.UI.worker.execute = async function (SESSION_ID, queue_obj) {
27853
27853
  const ret = await func.UI.screen.render_ui_tree(SESSION_ID, $div, nodeP.children[key], parent_infoP, paramsP, jobNoP, is_skeleton, Number(key), null, nodeP, null, $root_container);
27854
27854
  }
27855
27855
 
27856
- if (!UI_WORKER_OBJ.viewport_info[$div.parent().attr('xu-ui-id')]) {
27857
- UI_WORKER_OBJ.viewport_info[$div.parent().attr('xu-ui-id')] = { $elm: $div.parent(), height: $div.height() };
27856
+ const parent_id = $div.parent().attr('xu-ui-id');
27857
+ if (!UI_WORKER_OBJ.viewport_height_set_ids.includes(parent_id)) {
27858
+ UI_WORKER_OBJ.viewport_height_set_ids.push(parent_id);
27858
27859
  func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'set_viewport_height', { $elm: $div.parent(), height: $div.height() }, null, null, paramsP.dsSessionP);
27859
27860
  }
27860
- // if (!$div.parent().data().xuData.viewport_elm_height) {
27861
- // $div.parent().data().xuData.viewport_elm_height = $div.height();
27862
- // }
27861
+
27862
+ if ($div.hasClass('viewport_height')) {
27863
+ $div.addClass('viewport_height');
27864
+ $div.css('height', 'unset');
27865
+ }
27863
27866
  }
27864
27867
 
27865
27868
  return func.UI.worker.delete_job(SESSION_ID, queue_obj.job_num);
@@ -27867,9 +27870,13 @@ func.UI.worker.execute = async function (SESSION_ID, queue_obj) {
27867
27870
  set_viewport_height: async function () {
27868
27871
  const { $elm, height } = queue_obj?.paramsP || {};
27869
27872
 
27870
- // for (const [parent_elm_xu_ui_id, val] of Object.entries(UI_WORKER_OBJ.viewport_info)) {
27871
- $elm.children().css(height, height);
27872
- // }
27873
+ $elm.children().css('height', height);
27874
+
27875
+ $.each($elm.children(), function (key, elm) {
27876
+ if (!$(elm).height() && !$(elm).children()) {
27877
+ $(elm).css('height', height).addClass('viewport_height');
27878
+ }
27879
+ });
27873
27880
 
27874
27881
  return func.UI.worker.delete_job(SESSION_ID, queue_obj.job_num);
27875
27882
  },
@@ -31181,20 +31188,12 @@ func.UI.screen.init = async function (SESSION_ID, prog_id, sourceScreenP, callin
31181
31188
  fix_svg();
31182
31189
  }, 200);
31183
31190
 
31184
- // if ($div.parent().data().xuData.viewport_elm_height) {
31185
- // $div.css(height, $div.parent().data().xuData.viewport_elm_height);
31186
- // }
31187
-
31188
- // for (const [parent_elm_xu_ui_id, val] of Object.entries(UI_WORKER_OBJ.viewport_info)) {
31189
- // val.$elm.children().css(height, val.height);
31190
- // }
31191
-
31192
- // for (const item of UI_WORKER_OBJ.viewport_info) {
31193
- // item.children().css(innerHeight, item.height);
31194
- // }
31195
-
31196
31191
  func.UI.utils.indicator.screen.normal();
31197
31192
 
31193
+ for (const [container_xu_ui_id, data] of Object.entries(UI_WORKER_OBJ.pending_for_viewport_render)) {
31194
+ debugger;
31195
+ }
31196
+
31198
31197
  let ret_screen_loading = await func.UI.screen.screen_loading_done(SESSION_ID, params, ret_render_$container, jobNoP);
31199
31198
  return ret_screen_loading;
31200
31199
  }
@@ -34434,83 +34433,95 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
34434
34433
  if (ret.abort || nodeP.tagName === 'svg') return await done();
34435
34434
  // check if iterator made to prevent children render
34436
34435
 
34437
- const observer_inViewport = new IntersectionObserver(
34438
- function (entries) {
34439
- entries.forEach((entry) => {
34440
- if (entry.isIntersecting) {
34441
- // Element is in viewport - trigger custom event
34442
- // console.log('trigger>>', 'inViewport_' + $(entry.target).attr('xu-ui-id'));
34436
+ if (nodeP?.attributes?.['xu-viewport'] == 'true') {
34437
+ const xu_viewport = async function () {
34438
+ const data = { $div, nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $container };
34439
+ const container_id = $container.attr('xu-ui-id');
34440
+ if (!UI_WORKER_OBJ.pending_for_viewport_render[container_id]) {
34441
+ UI_WORKER_OBJ.pending_for_viewport_render[container_id] = [];
34442
+ await iterate_child($div, nodeP, parent_infoP, $root_container);
34443
+ }
34444
+ UI_WORKER_OBJ.pending_for_viewport_render[container_id].push(data);
34445
+
34446
+ // if (!$div.children().length) {
34447
+ // // render the first element to determine height
34448
+ // await iterate_child($div, nodeP, parent_infoP, $root_container);
34449
+ // // hover_in($div);
34450
+ // // func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'render_viewport', data, null, null, paramsP.dsSessionP);
34451
+ // } else {
34452
+ // }
34453
+ };
34454
+ const xu_viewport_old = function () {
34455
+ const observer_inViewport = new IntersectionObserver(
34456
+ function (entries) {
34457
+ entries.forEach((entry) => {
34458
+ if (entry.isIntersecting) {
34459
+ // Element is in viewport - trigger custom event
34460
+ // console.log('trigger>>', 'inViewport_' + $(entry.target).attr('xu-ui-id'));
34461
+
34462
+ // $(entry.target).trigger('inViewport_' + $(entry.target).attr('xu-ui-id'));
34463
+ $(entry.target).trigger('inViewport');
34464
+
34465
+ // Optional: stop observing once triggered
34466
+ observer_inViewport.unobserve(entry.target);
34467
+ }
34468
+ });
34469
+ },
34470
+ {
34471
+ threshold: 0.1, // Trigger when 10% of element is visible
34472
+ },
34473
+ );
34443
34474
 
34444
- // $(entry.target).trigger('inViewport_' + $(entry.target).attr('xu-ui-id'));
34445
- $(entry.target).trigger('inViewport');
34475
+ const observer_outViewport = new IntersectionObserver(
34476
+ function (entries) {
34477
+ entries.forEach((entry) => {
34478
+ if (!entry.isIntersecting) {
34479
+ // Element is OUT of viewport - trigger custom event
34480
+ $(entry.target).trigger('outViewport');
34446
34481
 
34447
- // Optional: stop observing once triggered
34448
- observer_inViewport.unobserve(entry.target);
34449
- }
34450
- });
34451
- },
34452
- {
34453
- threshold: 0.1, // Trigger when 10% of element is visible
34454
- },
34455
- );
34482
+ // Optional: stop observing once triggered
34483
+ // observer_outViewport.unobserve(entry.target);
34484
+ }
34485
+ });
34486
+ },
34487
+ {
34488
+ threshold: 0, // Trigger when element is completely out of view
34489
+ },
34490
+ );
34456
34491
 
34457
- const observer_outViewport = new IntersectionObserver(
34458
- function (entries) {
34459
- entries.forEach((entry) => {
34460
- if (!entry.isIntersecting) {
34461
- // Element is OUT of viewport - trigger custom event
34462
- $(entry.target).trigger('outViewport');
34492
+ // if ($div.parent().data().xuData.viewport_elm_height) {
34493
+ // $div.css(height, $div.parent().data().xuData.viewport_elm_height);
34494
+ // }
34463
34495
 
34464
- // Optional: stop observing once triggered
34465
- // observer_outViewport.unobserve(entry.target);
34496
+ $div.on('inViewport', function () {
34497
+ if ($div.children().length) {
34498
+ $div.removeClass('skeleton');
34499
+ return;
34466
34500
  }
34467
- });
34468
- },
34469
- {
34470
- threshold: 0, // Trigger when element is completely out of view
34471
- },
34472
- );
34473
-
34474
- if (nodeP?.attributes?.['xu-viewport'] == 'true') {
34475
- // if ($div.parent().data().xuData.viewport_elm_height) {
34476
- // $div.css(height, $div.parent().data().xuData.viewport_elm_height);
34477
- // }
34478
34501
 
34479
- $div.on('inViewport', function () {
34480
- if ($div.children().length) {
34481
- $div.removeClass('skeleton');
34482
- return;
34483
- }
34484
-
34485
- if (UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]) {
34486
- $div.removeClass('skeleton');
34487
- $div.html(UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]);
34488
- } else {
34489
- hover_in($div);
34490
- func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'render_viewport', { $div, nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $container }, null, null, paramsP.dsSessionP);
34491
- // //viewport_elm_height
34492
- // if (!$div.parent().data().xuData.viewport_elm_height) {
34493
- // setTimeout(() => {
34494
- // $div.parent().data().xuData.viewport_elm_height = $div.height();
34495
- // }, 2000);
34496
- // }
34497
- }
34498
- observer_outViewport.observe($div[0]);
34499
- });
34502
+ if (UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]) {
34503
+ $div.removeClass('skeleton');
34504
+ $div.html(UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]);
34505
+ } else {
34506
+ hover_in($div);
34507
+ func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'render_viewport', { $div, nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $container }, null, null, paramsP.dsSessionP);
34508
+ }
34509
+ observer_outViewport.observe($div[0]);
34510
+ });
34500
34511
 
34501
- $div.on('outViewport', function () {
34502
- if ($div.children().length) {
34503
- UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')] = $div.children().clone(true);
34504
- $div.empty();
34505
- }
34506
- // $div.addClass('skeleton');
34512
+ $div.on('outViewport', function () {
34513
+ if ($div.children().length) {
34514
+ UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')] = $div.children().clone(true);
34515
+ $div.empty();
34516
+ }
34517
+ // $div.addClass('skeleton');
34518
+ observer_inViewport.observe($div[0]);
34519
+ });
34520
+ $div.addClass('skeleton');
34507
34521
  observer_inViewport.observe($div[0]);
34508
- });
34509
- $div.addClass('skeleton');
34510
- observer_inViewport.observe($div[0]);
34511
- // observer_outViewport.observe($div[0]);
34522
+ };
34523
+ await xu_viewport();
34512
34524
  } else {
34513
- // await render_child();
34514
34525
  await iterate_child($div, nodeP, parent_infoP, $root_container);
34515
34526
  }
34516
34527