@xuda.io/runtime-bundle 1.0.1418 → 1.0.1420

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.
@@ -3926,10 +3926,8 @@ func.datasource.create = async function (
3926
3926
 
3927
3927
  var run_at = _prog_obj?.properties?.runAt;
3928
3928
 
3929
- if (!['live_preview', 'miniapp'].includes(_session.engine_mode)) {
3930
- if (_session.opt.app_computing_mode === 'main') {
3931
- run_at = 'client';
3932
- }
3929
+ if (_session.opt.app_computing_mode === 'main') {
3930
+ run_at = 'client';
3933
3931
  }
3934
3932
 
3935
3933
  if (_prog_obj?.properties.menuType === 'globals') {
@@ -9051,6 +9049,9 @@ func.runtime.ui.get_meta = function (xu_ui_id, key) {
9051
9049
  return key ? entry[key] : entry;
9052
9050
  };
9053
9051
  func.runtime.ui.delete_meta = function (xu_ui_id) {
9052
+ if (func.runtime.ui._meta_store[xu_ui_id]) {
9053
+ console.info('[xu-render-debug] delete_meta called for', xu_ui_id, new Error().stack?.split('\n').slice(1, 4).join(' <- '));
9054
+ }
9054
9055
  delete func.runtime.ui._meta_store[xu_ui_id];
9055
9056
  // clean reverse lookup
9056
9057
  for (const id in func.runtime.ui._element_id_to_xu_ui_id) {
@@ -11483,6 +11484,7 @@ func.UI.worker.execute = async function (SESSION_ID, queue_obj) {
11483
11484
  const perf_end = func.runtime?.perf?.start?.(SESSION_ID, 'execute_xu_render_attributes');
11484
11485
  const live_context = fx.get_live_element_context(queue_obj.paramsP?.elem_key, queue_obj.elementP || queue_obj.paramsP?.elem_val?.$elm, queue_obj.paramsP);
11485
11486
  const _data = live_context.data;
11487
+ console.info('[xu-render-debug] execute_xu_render_attributes', { elem_key: queue_obj.paramsP?.elem_key, has_live_elm: !!live_context.$elm?.length, has_data: !!_data, has_xuData: !!_data?.xuData, has_paramsP: !!_data?.xuData?.paramsP, attr_value: queue_obj.paramsP?.attr_value, elm_tag: func.runtime.ui.get_first_node(live_context.$elm)?.tagName, data_keys: Object.keys(_data || {}), xuData_keys: Object.keys(_data?.xuData || {}) });
11486
11488
  try {
11487
11489
  if (_data?.xuData?.paramsP) {
11488
11490
  const live_xu_data = _data.xuData;
@@ -12840,13 +12842,15 @@ func.runtime.ui.copy_runtime_state = function ($source, $target) {
12840
12842
  const xu_data_keys = Object.keys(source_data.xuData);
12841
12843
  for (let index = 0; index < xu_data_keys.length; index++) {
12842
12844
  const key = xu_data_keys[index];
12843
- target_data.xuData[key] = structuredClone(source_data.xuData[key]);
12845
+ const val = source_data.xuData[key];
12846
+ try { target_data.xuData[key] = structuredClone(val); } catch (_) { target_data.xuData[key] = val; }
12844
12847
  }
12845
12848
 
12846
12849
  const xu_attribute_keys = Object.keys(source_data.xuAttributes);
12847
12850
  for (let index = 0; index < xu_attribute_keys.length; index++) {
12848
12851
  const key = xu_attribute_keys[index];
12849
- target_data.xuAttributes[key] = structuredClone(source_data.xuAttributes[key]);
12852
+ const val = source_data.xuAttributes[key];
12853
+ try { target_data.xuAttributes[key] = structuredClone(val); } catch (_) { target_data.xuAttributes[key] = val; }
12850
12854
  }
12851
12855
  return $target;
12852
12856
  };
@@ -14732,6 +14736,7 @@ func.runtime.ui.refresh_xu_attributes = async function (options) {
14732
14736
  const attr_value = await func.common.get_cast_val(options.SESSION_ID, 'refresh xu-attributes', 'xu-render', 'bool', res.result);
14733
14737
 
14734
14738
  const _elm_node = func.runtime.ui.get_first_node($elm);
14739
+ console.info('[xu-render-debug] refresh has_xu_exp_render', { elem_key, attr_value, elm_tag: _elm_node?.tagName, exp_value: xuAttributes['xu-exp:xu-render'], result: res.result });
14735
14740
  if (!attr_value && _elm_node?.tagName === 'XURENDER') continue;
14736
14741
 
14737
14742
  if (attr_value && _elm_node?.tagName !== 'XURENDER') {
@@ -17627,6 +17632,8 @@ func.runtime.widgets = func.runtime.widgets || {};
17627
17632
 
17628
17633
  func.runtime.render.handle_legacy_xu_render = async function (options) {
17629
17634
  const value = await func.common.get_cast_val(options.SESSION_ID, 'common fx', 'xu-render', 'bool', options.val.value);
17635
+ const _xu_ui_id_dbg = func.runtime.ui.get_attr(options.$elm, 'xu-ui-id');
17636
+ console.info('[xu-render-debug] handle_legacy_xu_render called', { value, is_init: options.is_init, xu_ui_id: _xu_ui_id_dbg, elm_tag: func.runtime.ui.get_first_node(options.$elm)?.tagName });
17630
17637
 
17631
17638
  const init_render = function () {
17632
17639
  if (!value) {
@@ -17640,15 +17647,20 @@ func.runtime.render.handle_legacy_xu_render = async function (options) {
17640
17647
  parent_nodeP: options.parent_nodeP,
17641
17648
  $root_container: options.$root_container,
17642
17649
  });
17643
- // Snapshot xuData before remove deletes the meta store entry (shared xu-ui-id)
17650
+ // Snapshot xuData while meta store still holds the entry
17644
17651
  const snapshot_xuData = func.runtime.ui.get_data(cloned_div).xuData;
17645
17652
  const snapshot_xuAttributes = options.nodeP.attributes || {};
17646
17653
  const xu_ui_id = func.runtime.ui.get_attr(options.$elm, 'xu-ui-id');
17647
17654
 
17648
- // Remove original element first (clears _meta_store for this xu-ui-id)
17649
- func.runtime.ui.remove(options.$elm);
17655
+ console.info('[xu-render-debug] init_render hiding', { xu_ui_id, has_snapshot_xuData: !!snapshot_xuData, has_paramsP: !!snapshot_xuData?.paramsP, has_original_data_obj: !!original_data_obj, snapshot_xuAttributes_keys: Object.keys(snapshot_xuAttributes) });
17650
17656
 
17651
- // Then create XURENDER placeholder (writes fresh meta store entry)
17657
+ // Remove original element from DOM WITHOUT deleting _meta_store.
17658
+ const _elm_node = func.runtime.ui.get_first_node(options.$elm);
17659
+ if (_elm_node?.remove) {
17660
+ _elm_node.remove();
17661
+ }
17662
+
17663
+ // Create XURENDER placeholder (overwrites meta store entry for this xu-ui-id)
17652
17664
  func.runtime.render.create_xu_render_placeholder(xu_ui_id, options.$container, {
17653
17665
  hidden: true,
17654
17666
  xuData: snapshot_xuData,
@@ -17657,6 +17669,10 @@ func.runtime.render.handle_legacy_xu_render = async function (options) {
17657
17669
  xuAttributes: snapshot_xuAttributes,
17658
17670
  });
17659
17671
 
17672
+ // Verify data was written correctly
17673
+ const verify_meta = func.runtime.ui._meta_store[xu_ui_id];
17674
+ console.info('[xu-render-debug] init_render DONE', { xu_ui_id, meta_exists: !!verify_meta, has_xuData: !!verify_meta?.xuData, has_paramsP: !!verify_meta?.xuData?.paramsP, has_original_data_obj: !!verify_meta?.xuData?.original_data_obj, has_xuAttributes: !!verify_meta?.xuAttributes });
17675
+
17660
17676
  return { abort: true };
17661
17677
  }
17662
17678
  return {};
@@ -17688,12 +17704,18 @@ func.runtime.render.handle_legacy_xu_render = async function (options) {
17688
17704
  if (value) {
17689
17705
  try {
17690
17706
  const elm_node = func.runtime.ui.get_first_node(options.$elm);
17707
+ const _post_xu_ui_id = func.runtime.ui.get_attr(options.$elm, 'xu-ui-id');
17708
+ const _post_meta = func.runtime.ui._meta_store[_post_xu_ui_id];
17709
+ const _post_data = func.runtime.ui.get_data(options.$elm);
17710
+ console.info('[xu-render-debug] post_render value=true', { xu_ui_id: _post_xu_ui_id, elm_tag: elm_node?.tagName, meta_exists: !!_post_meta, has_xuData: !!_post_data?.xuData, has_paramsP: !!_post_data?.xuData?.paramsP, has_original_data_obj: !!_post_data?.xuData?.original_data_obj, xuData_keys: Object.keys(_post_data?.xuData || {}), data_keys: Object.keys(_post_data || {}) });
17691
17711
  if (elm_node?.tagName !== 'XURENDER' && elm_node) {
17712
+ console.info('[xu-render-debug] post_render SKIP: not XURENDER tag', elm_node?.tagName);
17692
17713
  return func.events.delete_job(options.SESSION_ID, options.jobNoP);
17693
17714
  }
17694
17715
 
17695
17716
  const original_data_obj = func.runtime.ui.get_data(options.$elm).xuData.original_data_obj;
17696
17717
  if (!original_data_obj) {
17718
+ console.info('[xu-render-debug] post_render SKIP: no original_data_obj');
17697
17719
  func.events.delete_job(options.SESSION_ID, options.jobNoP);
17698
17720
  return { delete_job: options.jobNoP };
17699
17721
  }
@@ -3852,10 +3852,8 @@ func.datasource.create = async function (
3852
3852
 
3853
3853
  var run_at = _prog_obj?.properties?.runAt;
3854
3854
 
3855
- if (!['live_preview', 'miniapp'].includes(_session.engine_mode)) {
3856
- if (_session.opt.app_computing_mode === 'main') {
3857
- run_at = 'client';
3858
- }
3855
+ if (_session.opt.app_computing_mode === 'main') {
3856
+ run_at = 'client';
3859
3857
  }
3860
3858
 
3861
3859
  if (_prog_obj?.properties.menuType === 'globals') {
@@ -8977,6 +8975,9 @@ func.runtime.ui.get_meta = function (xu_ui_id, key) {
8977
8975
  return key ? entry[key] : entry;
8978
8976
  };
8979
8977
  func.runtime.ui.delete_meta = function (xu_ui_id) {
8978
+ if (func.runtime.ui._meta_store[xu_ui_id]) {
8979
+ console.info('[xu-render-debug] delete_meta called for', xu_ui_id, new Error().stack?.split('\n').slice(1, 4).join(' <- '));
8980
+ }
8980
8981
  delete func.runtime.ui._meta_store[xu_ui_id];
8981
8982
  // clean reverse lookup
8982
8983
  for (const id in func.runtime.ui._element_id_to_xu_ui_id) {
@@ -11409,6 +11410,7 @@ func.UI.worker.execute = async function (SESSION_ID, queue_obj) {
11409
11410
  const perf_end = func.runtime?.perf?.start?.(SESSION_ID, 'execute_xu_render_attributes');
11410
11411
  const live_context = fx.get_live_element_context(queue_obj.paramsP?.elem_key, queue_obj.elementP || queue_obj.paramsP?.elem_val?.$elm, queue_obj.paramsP);
11411
11412
  const _data = live_context.data;
11413
+ console.info('[xu-render-debug] execute_xu_render_attributes', { elem_key: queue_obj.paramsP?.elem_key, has_live_elm: !!live_context.$elm?.length, has_data: !!_data, has_xuData: !!_data?.xuData, has_paramsP: !!_data?.xuData?.paramsP, attr_value: queue_obj.paramsP?.attr_value, elm_tag: func.runtime.ui.get_first_node(live_context.$elm)?.tagName, data_keys: Object.keys(_data || {}), xuData_keys: Object.keys(_data?.xuData || {}) });
11412
11414
  try {
11413
11415
  if (_data?.xuData?.paramsP) {
11414
11416
  const live_xu_data = _data.xuData;
@@ -12766,13 +12768,15 @@ func.runtime.ui.copy_runtime_state = function ($source, $target) {
12766
12768
  const xu_data_keys = Object.keys(source_data.xuData);
12767
12769
  for (let index = 0; index < xu_data_keys.length; index++) {
12768
12770
  const key = xu_data_keys[index];
12769
- target_data.xuData[key] = structuredClone(source_data.xuData[key]);
12771
+ const val = source_data.xuData[key];
12772
+ try { target_data.xuData[key] = structuredClone(val); } catch (_) { target_data.xuData[key] = val; }
12770
12773
  }
12771
12774
 
12772
12775
  const xu_attribute_keys = Object.keys(source_data.xuAttributes);
12773
12776
  for (let index = 0; index < xu_attribute_keys.length; index++) {
12774
12777
  const key = xu_attribute_keys[index];
12775
- target_data.xuAttributes[key] = structuredClone(source_data.xuAttributes[key]);
12778
+ const val = source_data.xuAttributes[key];
12779
+ try { target_data.xuAttributes[key] = structuredClone(val); } catch (_) { target_data.xuAttributes[key] = val; }
12776
12780
  }
12777
12781
  return $target;
12778
12782
  };
@@ -14658,6 +14662,7 @@ func.runtime.ui.refresh_xu_attributes = async function (options) {
14658
14662
  const attr_value = await func.common.get_cast_val(options.SESSION_ID, 'refresh xu-attributes', 'xu-render', 'bool', res.result);
14659
14663
 
14660
14664
  const _elm_node = func.runtime.ui.get_first_node($elm);
14665
+ console.info('[xu-render-debug] refresh has_xu_exp_render', { elem_key, attr_value, elm_tag: _elm_node?.tagName, exp_value: xuAttributes['xu-exp:xu-render'], result: res.result });
14661
14666
  if (!attr_value && _elm_node?.tagName === 'XURENDER') continue;
14662
14667
 
14663
14668
  if (attr_value && _elm_node?.tagName !== 'XURENDER') {
@@ -17553,6 +17558,8 @@ func.runtime.widgets = func.runtime.widgets || {};
17553
17558
 
17554
17559
  func.runtime.render.handle_legacy_xu_render = async function (options) {
17555
17560
  const value = await func.common.get_cast_val(options.SESSION_ID, 'common fx', 'xu-render', 'bool', options.val.value);
17561
+ const _xu_ui_id_dbg = func.runtime.ui.get_attr(options.$elm, 'xu-ui-id');
17562
+ console.info('[xu-render-debug] handle_legacy_xu_render called', { value, is_init: options.is_init, xu_ui_id: _xu_ui_id_dbg, elm_tag: func.runtime.ui.get_first_node(options.$elm)?.tagName });
17556
17563
 
17557
17564
  const init_render = function () {
17558
17565
  if (!value) {
@@ -17566,15 +17573,20 @@ func.runtime.render.handle_legacy_xu_render = async function (options) {
17566
17573
  parent_nodeP: options.parent_nodeP,
17567
17574
  $root_container: options.$root_container,
17568
17575
  });
17569
- // Snapshot xuData before remove deletes the meta store entry (shared xu-ui-id)
17576
+ // Snapshot xuData while meta store still holds the entry
17570
17577
  const snapshot_xuData = func.runtime.ui.get_data(cloned_div).xuData;
17571
17578
  const snapshot_xuAttributes = options.nodeP.attributes || {};
17572
17579
  const xu_ui_id = func.runtime.ui.get_attr(options.$elm, 'xu-ui-id');
17573
17580
 
17574
- // Remove original element first (clears _meta_store for this xu-ui-id)
17575
- func.runtime.ui.remove(options.$elm);
17581
+ console.info('[xu-render-debug] init_render hiding', { xu_ui_id, has_snapshot_xuData: !!snapshot_xuData, has_paramsP: !!snapshot_xuData?.paramsP, has_original_data_obj: !!original_data_obj, snapshot_xuAttributes_keys: Object.keys(snapshot_xuAttributes) });
17576
17582
 
17577
- // Then create XURENDER placeholder (writes fresh meta store entry)
17583
+ // Remove original element from DOM WITHOUT deleting _meta_store.
17584
+ const _elm_node = func.runtime.ui.get_first_node(options.$elm);
17585
+ if (_elm_node?.remove) {
17586
+ _elm_node.remove();
17587
+ }
17588
+
17589
+ // Create XURENDER placeholder (overwrites meta store entry for this xu-ui-id)
17578
17590
  func.runtime.render.create_xu_render_placeholder(xu_ui_id, options.$container, {
17579
17591
  hidden: true,
17580
17592
  xuData: snapshot_xuData,
@@ -17583,6 +17595,10 @@ func.runtime.render.handle_legacy_xu_render = async function (options) {
17583
17595
  xuAttributes: snapshot_xuAttributes,
17584
17596
  });
17585
17597
 
17598
+ // Verify data was written correctly
17599
+ const verify_meta = func.runtime.ui._meta_store[xu_ui_id];
17600
+ console.info('[xu-render-debug] init_render DONE', { xu_ui_id, meta_exists: !!verify_meta, has_xuData: !!verify_meta?.xuData, has_paramsP: !!verify_meta?.xuData?.paramsP, has_original_data_obj: !!verify_meta?.xuData?.original_data_obj, has_xuAttributes: !!verify_meta?.xuAttributes });
17601
+
17586
17602
  return { abort: true };
17587
17603
  }
17588
17604
  return {};
@@ -17614,12 +17630,18 @@ func.runtime.render.handle_legacy_xu_render = async function (options) {
17614
17630
  if (value) {
17615
17631
  try {
17616
17632
  const elm_node = func.runtime.ui.get_first_node(options.$elm);
17633
+ const _post_xu_ui_id = func.runtime.ui.get_attr(options.$elm, 'xu-ui-id');
17634
+ const _post_meta = func.runtime.ui._meta_store[_post_xu_ui_id];
17635
+ const _post_data = func.runtime.ui.get_data(options.$elm);
17636
+ console.info('[xu-render-debug] post_render value=true', { xu_ui_id: _post_xu_ui_id, elm_tag: elm_node?.tagName, meta_exists: !!_post_meta, has_xuData: !!_post_data?.xuData, has_paramsP: !!_post_data?.xuData?.paramsP, has_original_data_obj: !!_post_data?.xuData?.original_data_obj, xuData_keys: Object.keys(_post_data?.xuData || {}), data_keys: Object.keys(_post_data || {}) });
17617
17637
  if (elm_node?.tagName !== 'XURENDER' && elm_node) {
17638
+ console.info('[xu-render-debug] post_render SKIP: not XURENDER tag', elm_node?.tagName);
17618
17639
  return func.events.delete_job(options.SESSION_ID, options.jobNoP);
17619
17640
  }
17620
17641
 
17621
17642
  const original_data_obj = func.runtime.ui.get_data(options.$elm).xuData.original_data_obj;
17622
17643
  if (!original_data_obj) {
17644
+ console.info('[xu-render-debug] post_render SKIP: no original_data_obj');
17623
17645
  func.events.delete_job(options.SESSION_ID, options.jobNoP);
17624
17646
  return { delete_job: options.jobNoP };
17625
17647
  }