@xuda.io/runtime-bundle 1.0.1089 → 1.0.1091

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.
@@ -31890,7 +31890,7 @@ func.UI.screen.execute_xu_functions = async function (SESSION_ID, is_skeleton, $
31890
31890
  }
31891
31891
  $elm.remove();
31892
31892
  } else {
31893
- $elm.data('xuTeleportData', []);
31893
+ $elm.data('xuTeleportData', []).attr('hidden', true);
31894
31894
  for (const [key, node] of Object.entries(nodeP.children)) {
31895
31895
  const $to_container = $(val.value);
31896
31896
  if (!$to_container?.length) {
@@ -34427,36 +34427,156 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
34427
34427
  },
34428
34428
  };
34429
34429
 
34430
- const draw_html_element = async function (element) {
34431
- // let temp_$container = $('<tmp>').data('xuData', $container.data().xuData);
34432
- // if (!glb.new_xu_render) {
34433
- // temp_$container = $container;
34434
- // }
34430
+ const draw_html_element_org = async function (element) {
34435
34431
  const done = async function (ret = {}) {
34436
- if (glb.new_xu_render) {
34437
- const xu_ui_id = $div.attr('xu-ui-id');
34438
- if (ret.has_xu_exp_render_attribute) {
34439
- const xu_render_cache_id = await get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP, Object.keys($div.data()?.xuData?.attr_exp_info?.['xu-render']?.fields || {}));
34440
- UI_WORKER_OBJ.xu_render_cache[xu_ui_id + xu_render_cache_id] = { $div: $div.clone(true), paramsP };
34441
- nodeP.xu_render_xu_ui_id = xu_ui_id;
34442
- nodeP.xu_render_cache_id = xu_render_cache_id;
34443
- if (ret.xu_render_background_processing) {
34444
- $container.find(`[xu-ui-id="${xu_ui_id}"]`).remove();
34445
- return $div;
34446
- } //else {
34447
- // $container.append(temp_$container.children());
34448
- // return $div;
34432
+ return $div;
34433
+ };
34434
+ if (!element || element === 'script') return await done();
34435
+ let str = '';
34436
+
34437
+ var $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, element, null, str);
34438
+
34439
+ $div.hover(
34440
+ function (e) {
34441
+ hover_in($div, e);
34442
+ },
34443
+ function (e) {
34444
+ hover_out();
34445
+ },
34446
+ );
34447
+ if (paramsP.paramsP === 'grid' || parent_infoP?.iterate_info) {
34448
+ $div.on('click contextmenu', function (e) {
34449
+ hover_in($div, e);
34450
+ });
34451
+ }
34452
+
34453
+ let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $container, nodeP, $div, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true);
34454
+ if (ret.abort || nodeP.tagName === 'svg' || !_.isEmpty(nodeP?.attributes?.['xu-text']) || !_.isEmpty(nodeP?.attributes?.['xu-html']) || !_.isEmpty(nodeP?.attributes?.['xu-exp:xu-text']) || !_.isEmpty(nodeP?.attributes?.['xu-exp:xu-html'])) {
34455
+ return await done(ret);
34456
+ }
34457
+ // check if iterator made to prevent children render
34458
+
34459
+ if (nodeP?.attributes?.['xu-viewport'] == 'true') {
34460
+ // const xu_viewport = async function () {
34461
+ // const data = { $div: $div.clone(true), nodeP, parent_infoP, $root_container, paramsP, jobNoP, is_skeleton, keyP, refreshed_ds, parent_nodeP, check_existP, $container };
34462
+ // const container_id = $container.attr('xu-ui-id');
34463
+ // if (!UI_WORKER_OBJ.pending_for_viewport_render[container_id]) {
34464
+ // UI_WORKER_OBJ.pending_for_viewport_render[container_id] = { base_$div: $div, data: [], $container };
34465
+ // await iterate_child($div, nodeP, parent_infoP, $root_container);
34466
+ // } else {
34467
+ // $div.remove();
34468
+ // }
34469
+ // UI_WORKER_OBJ.pending_for_viewport_render[container_id].data.push(data);
34470
+
34471
+ // // if (!$div.children().length) {
34472
+ // // // render the first element to determine height
34473
+ // // await iterate_child($div, nodeP, parent_infoP, $root_container);
34474
+ // // // hover_in($div);
34475
+ // // // func.UI.worker.add_to_queue(SESSION_ID, 'gui event', 'render_viewport', data, null, null, paramsP.dsSessionP);
34476
+ // // } else {
34477
+ // // }
34478
+ // };
34479
+ const xu_viewport = function () {
34480
+ const observer_inViewport = new IntersectionObserver(
34481
+ function (entries) {
34482
+ entries.forEach((entry) => {
34483
+ if (entry.isIntersecting) {
34484
+ $(entry.target).trigger('inViewport');
34485
+
34486
+ // Optional: stop observing once triggered
34487
+ observer_inViewport.unobserve(entry.target);
34488
+ }
34489
+ });
34490
+ },
34491
+ {
34492
+ threshold: 0.1, // Trigger when 10% of element is visible
34493
+ },
34494
+ );
34495
+
34496
+ const observer_outViewport = new IntersectionObserver(
34497
+ function (entries) {
34498
+ entries.forEach((entry) => {
34499
+ if (!entry.isIntersecting) {
34500
+ // Element is OUT of viewport - trigger custom event
34501
+ $(entry.target).trigger('outViewport');
34502
+
34503
+ // Optional: stop observing once triggered
34504
+ // observer_outViewport.unobserve(entry.target);
34505
+ }
34506
+ });
34507
+ },
34508
+ {
34509
+ threshold: 0, // Trigger when element is completely out of view
34510
+ },
34511
+ );
34512
+
34513
+ let ui_job_id;
34514
+ $div.on('inViewport', function () {
34515
+ if ($div.children().length) {
34516
+ $div.removeClass('skeleton');
34517
+ return;
34518
+ }
34519
+
34520
+ // if (UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]) {
34521
+ // $div[0].style.removeProperty('height');
34522
+ // $div.removeClass('skeleton');
34523
+ // $div.html(UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')]);
34524
+ // } else {
34525
+ hover_in($div);
34526
+ ui_job_id = 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, temp_$container }, null, null, paramsP.dsSessionP);
34449
34527
  // }
34528
+ observer_outViewport.observe($div[0]);
34529
+ });
34450
34530
 
34451
- return $div;
34452
- } else {
34453
- // $container.append(temp_$container.children());
34454
- if (ret.has_xu_render_attribute) {
34455
- $container.find(`[xu-ui-id="${xu_ui_id}"]`).remove();
34531
+ $div.on('outViewport', function () {
34532
+ func.UI.worker.delete_job(SESSION_ID, ui_job_id);
34533
+
34534
+ if ($div.children().length) {
34535
+ // UI_WORKER_OBJ.cache[$div.attr('xu-ui-id')] = $div.children().clone(true);
34536
+ $div.empty();
34537
+ const height = $div?.data()?.xuData?.viewport_height || 10;
34538
+ if (typeof height !== 'undefined') {
34539
+ $div.css('height', height);
34540
+ }
34456
34541
  }
34542
+ // $div.addClass('skeleton');
34543
+ observer_inViewport.observe($div[0]);
34544
+ });
34545
+ $div.addClass('skeleton');
34546
+ observer_inViewport.observe($div[0]);
34547
+ };
34548
+ xu_viewport();
34549
+ } else {
34550
+ await iterate_child($div, nodeP, parent_infoP, $root_container);
34551
+ }
34552
+
34553
+ // const ret_iterate_child = await iterate_child($div, nodeP, parent_infoP, null, $root_container);
34554
+ return await done(ret);
34555
+ };
34556
+
34557
+ const draw_html_element = async function (element) {
34558
+ const done = async function (ret = {}) {
34559
+ const xu_ui_id = $div.attr('xu-ui-id');
34560
+ $div.css('display', 'unset');
34561
+ if (ret.has_xu_exp_render_attribute) {
34562
+ const xu_render_cache_id = await get_xu_render_cache_str(SESSION_ID, paramsP.dsSessionP, Object.keys($div.data()?.xuData?.attr_exp_info?.['xu-render']?.fields || {}));
34563
+ UI_WORKER_OBJ.xu_render_cache[xu_ui_id + xu_render_cache_id] = { $div: $div.clone(true), paramsP };
34564
+ nodeP.xu_render_xu_ui_id = xu_ui_id;
34565
+ nodeP.xu_render_cache_id = xu_render_cache_id;
34566
+ if (ret.xu_render_background_processing) {
34567
+ $container.find(`[xu-ui-id="${xu_ui_id}"]`).remove();
34457
34568
  return $div;
34458
- }
34569
+ } //else {
34570
+ // $container.append(temp_$container.children());
34571
+ // return $div;
34572
+ // }
34573
+
34574
+ return $div;
34459
34575
  } else {
34576
+ // $container.append(temp_$container.children());
34577
+ if (ret.has_xu_render_attribute) {
34578
+ $container.find(`[xu-ui-id="${xu_ui_id}"]`).remove();
34579
+ }
34460
34580
  return $div;
34461
34581
  }
34462
34582
  };
@@ -34465,6 +34585,11 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
34465
34585
 
34466
34586
  var $div = await func.UI.screen.create_container(SESSION_ID, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, prop, null, null, element, null, str);
34467
34587
 
34588
+ $div.css('display', 'none');
34589
+
34590
+ let temp_$container = $('<tmp>').data('xuData', $container.data().xuData);
34591
+ let temp_$div = $div.clone(true);
34592
+
34468
34593
  $div.hover(
34469
34594
  function (e) {
34470
34595
  hover_in($div, e);
@@ -34479,7 +34604,7 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
34479
34604
  });
34480
34605
  }
34481
34606
 
34482
- let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, $container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, $div, true);
34607
+ let ret = await func.UI.screen.set_attributes_new(SESSION_ID, is_skeleton, $root_container, nodeP, temp_$container, paramsP, parent_infoP, jobNoP, keyP, parent_nodeP, temp_$div, true);
34483
34608
  if (ret.abort || nodeP.tagName === 'svg' || !_.isEmpty(nodeP?.attributes?.['xu-text']) || !_.isEmpty(nodeP?.attributes?.['xu-html']) || !_.isEmpty(nodeP?.attributes?.['xu-exp:xu-text']) || !_.isEmpty(nodeP?.attributes?.['xu-exp:xu-html'])) {
34484
34609
  return await done(ret);
34485
34610
  }
@@ -34576,13 +34701,9 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
34576
34701
  };
34577
34702
  xu_viewport();
34578
34703
  } else {
34579
- if (glb.new_xu_render) {
34580
- if (ret.xu_render_background_processing) {
34581
- let temp_$div = $div.clone(true);
34582
- iterate_child(temp_$div, nodeP, parent_infoP, $root_container);
34583
- } else {
34584
- await iterate_child($div, nodeP, parent_infoP, $root_container);
34585
- }
34704
+ if (ret.xu_render_background_processing) {
34705
+ // let temp_$div = $div.clone(true);
34706
+ iterate_child($div, nodeP, parent_infoP, $root_container);
34586
34707
  } else {
34587
34708
  await iterate_child($div, nodeP, parent_infoP, $root_container);
34588
34709
  }
@@ -34616,7 +34737,11 @@ func.UI.screen.render_ui_tree = async function (SESSION_ID, $container, nodeP, p
34616
34737
  // if (nodeP?.attributes?.['xu-viewport'] == 'true') {
34617
34738
  // return await xu_viewport();
34618
34739
  // } else {
34740
+ if (!glb.new_xu_render) {
34741
+ return await draw_html_element_org(nodeP.tagName);
34742
+ }
34619
34743
  return await draw_html_element(nodeP.tagName);
34744
+
34620
34745
  // }
34621
34746
  };
34622
34747