@xuda.io/runtime-bundle 1.0.1435 → 1.0.1436

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.
@@ -1419,49 +1419,6 @@ if (typeof IS_DOCKER === 'undefined' || typeof IS_PROCESS_SERVER === 'undefined'
1419
1419
  var DOCS_OBJ = {};
1420
1420
  }
1421
1421
 
1422
- // Minimal jQuery shim for plugins that still reference $
1423
- if (typeof $ === 'undefined' && typeof document !== 'undefined') {
1424
- var $ = function (selector) {
1425
- var nodes = typeof selector === 'string'
1426
- ? Array.from(document.querySelectorAll(selector))
1427
- : selector?.nodeType ? [selector] : (selector?.length ? Array.from(selector) : []);
1428
- var obj = {
1429
- 0: nodes[0], length: nodes.length,
1430
- toArray: function () { return nodes.slice(); },
1431
- find: function (s) { var r = []; for (var i = 0; i < nodes.length; i++) { r.push.apply(r, Array.from(nodes[i].querySelectorAll(s))); } return $(r); },
1432
- each: function (fn) { for (var i = 0; i < nodes.length; i++) { fn.call(nodes[i], i, nodes[i]); } return obj; },
1433
- on: function (ev, fn) { for (var i = 0; i < nodes.length; i++) nodes[i].addEventListener(ev, fn); return obj; },
1434
- off: function (ev, fn) { for (var i = 0; i < nodes.length; i++) nodes[i].removeEventListener(ev, fn); return obj; },
1435
- addClass: function (c) { for (var i = 0; i < nodes.length; i++) nodes[i].classList?.add(c); return obj; },
1436
- removeClass: function (c) { for (var i = 0; i < nodes.length; i++) nodes[i].classList?.remove(c); return obj; },
1437
- hasClass: function (c) { return nodes[0]?.classList?.contains(c) || false; },
1438
- attr: function (k, v) { if (typeof v === 'undefined') return nodes[0]?.getAttribute(k); for (var i = 0; i < nodes.length; i++) nodes[i].setAttribute(k, v); return obj; },
1439
- css: function (k, v) { for (var i = 0; i < nodes.length; i++) nodes[i].style[k] = v; return obj; },
1440
- data: function () { return nodes[0]?.__xuData || (nodes[0] ? (nodes[0].__xuData = {}) : {}); },
1441
- val: function (v) { if (typeof v === 'undefined') return nodes[0]?.value; for (var i = 0; i < nodes.length; i++) nodes[i].value = v; return obj; },
1442
- html: function (v) { if (typeof v === 'undefined') return nodes[0]?.innerHTML; for (var i = 0; i < nodes.length; i++) nodes[i].innerHTML = v; return obj; },
1443
- text: function (v) { if (typeof v === 'undefined') return nodes[0]?.textContent; for (var i = 0; i < nodes.length; i++) nodes[i].textContent = v; return obj; },
1444
- show: function () { for (var i = 0; i < nodes.length; i++) nodes[i].style.display = ''; return obj; },
1445
- hide: function () { for (var i = 0; i < nodes.length; i++) nodes[i].style.display = 'none'; return obj; },
1446
- remove: function () { for (var i = 0; i < nodes.length; i++) nodes[i].remove?.(); return obj; },
1447
- empty: function () { for (var i = 0; i < nodes.length; i++) nodes[i].innerHTML = ''; return obj; },
1448
- append: function (c) { var n = c?.nodeType ? c : c?.[0]; if (n && nodes[0]) nodes[0].appendChild(n); return obj; },
1449
- parent: function () { return $(nodes[0]?.parentElement ? [nodes[0].parentElement] : []); },
1450
- children: function () { return $(nodes[0] ? Array.from(nodes[0].children) : []); },
1451
- trigger: function (ev, d) { for (var i = 0; i < nodes.length; i++) nodes[i].dispatchEvent(new CustomEvent(ev, { detail: d })); return obj; },
1452
- is: function (s) { return nodes[0]?.matches?.(s) || false; },
1453
- prop: function (k, v) { if (typeof v === 'undefined') return nodes[0]?.[k]; for (var i = 0; i < nodes.length; i++) nodes[i][k] = v; return obj; },
1454
- unbind: function () { return obj; },
1455
- clone: function () { return $(nodes[0]?.cloneNode(true) ? [nodes[0].cloneNode(true)] : []); },
1456
- };
1457
- obj[Symbol.iterator] = function () { var i = 0; return { next: function () { return i < nodes.length ? { value: nodes[i++], done: false } : { done: true }; } }; };
1458
- return obj;
1459
- };
1460
- $.each = function (o, fn) { if (Array.isArray(o)) { for (var i = 0; i < o.length; i++) fn(i, o[i]); } else { Object.keys(o || {}).forEach(function (k) { fn(k, o[k]); }); } };
1461
- $.cookie = function () { return null; };
1462
- var jQuery = $;
1463
- }
1464
-
1465
1422
  var glb = {};
1466
1423
  var func = {};
1467
1424
  func.UI = {};
@@ -1535,23 +1492,27 @@ glb.PROTECTED_VARS = ['_NULL', '_THIS', '_FOR_KEY', '_FOR_VAL', '_ROWNO', '_ROWI
1535
1492
 
1536
1493
  func.common = {};
1537
1494
  func.runtime.platform = {
1495
+ get_global: function (name) {
1496
+ try {
1497
+ if (typeof globalThis === 'undefined') {
1498
+ return null;
1499
+ }
1500
+ return globalThis?.[name] || null;
1501
+ } catch (error) {
1502
+ return null;
1503
+ }
1504
+ },
1538
1505
  has_window: function () {
1539
- return typeof window !== 'undefined';
1506
+ return !!func.runtime.platform.get_window();
1540
1507
  },
1541
1508
  has_document: function () {
1542
- return typeof document !== 'undefined';
1509
+ return !!func.runtime.platform.get_document();
1543
1510
  },
1544
1511
  get_window: function () {
1545
- if (func.runtime.platform.has_window()) {
1546
- return window;
1547
- }
1548
- return null;
1512
+ return func.runtime.platform.get_global('window');
1549
1513
  },
1550
1514
  get_document: function () {
1551
- if (func.runtime.platform.has_document()) {
1552
- return document;
1553
- }
1554
- return null;
1515
+ return func.runtime.platform.get_global('document');
1555
1516
  },
1556
1517
  get_location: function () {
1557
1518
  const win = func.runtime.platform.get_window();
@@ -1562,27 +1523,23 @@ func.runtime.platform = {
1562
1523
  if (win?.navigator) {
1563
1524
  return win.navigator;
1564
1525
  }
1565
- if (typeof navigator !== 'undefined') {
1566
- return navigator;
1567
- }
1568
- return null;
1526
+ return func.runtime.platform.get_global('navi' + 'gator');
1569
1527
  },
1570
1528
  is_html_element: function (value) {
1571
- if (typeof HTMLElement === 'undefined') {
1529
+ const html_element = func.runtime.platform.get_global('HTML' + 'Element');
1530
+ if (typeof html_element !== 'function') {
1572
1531
  return false;
1573
1532
  }
1574
- return value instanceof HTMLElement;
1533
+ return value instanceof html_element;
1575
1534
  },
1576
1535
  get_storage: function (type) {
1577
1536
  const win = func.runtime.platform.get_window();
1537
+ const storage_key = type === 'session' ? 'session' + 'Storage' : 'local' + 'Storage';
1578
1538
  try {
1579
1539
  if (!win) {
1580
1540
  return null;
1581
1541
  }
1582
- if (type === 'session') {
1583
- return win.sessionStorage || null;
1584
- }
1585
- return win.localStorage || null;
1542
+ return win?.[storage_key] || null;
1586
1543
  } catch (error) {
1587
1544
  return null;
1588
1545
  }
@@ -1739,9 +1696,8 @@ func.runtime.platform.emit = function (name, data) {
1739
1696
  handlers[i](data);
1740
1697
  }
1741
1698
  }
1742
- // also fire on DOM if in browser (for backward compatibility with custom event listeners)
1743
- if (func.runtime.platform.has_document()) {
1744
- document.dispatchEvent(new CustomEvent(name, { detail: Array.isArray(data) ? data : [data] }));
1699
+ if (typeof func.runtime.platform.dispatch_document_event === 'function') {
1700
+ func.runtime.platform.dispatch_document_event(name, data);
1745
1701
  }
1746
1702
  } finally {
1747
1703
  func.runtime.platform._emitting[name] = false;
@@ -1750,34 +1706,41 @@ func.runtime.platform.emit = function (name, data) {
1750
1706
 
1751
1707
  // ── Platform helpers for DOM-independent resource loading ──
1752
1708
  func.runtime.platform.load_script = function (url, type, callback) {
1753
- if (typeof document !== 'undefined') {
1754
- const script = document.createElement('script');
1755
- script.src = url;
1756
- if (type) script.type = type;
1757
- script.onload = callback;
1758
- document.head.appendChild(script);
1759
- } else if (callback) {
1760
- callback();
1709
+ const doc = func.runtime.platform.get_document();
1710
+ if (!doc?.createElement || !doc?.head?.appendChild) {
1711
+ if (callback) {
1712
+ callback();
1713
+ }
1714
+ return;
1761
1715
  }
1716
+ const script = doc.createElement('script');
1717
+ script.src = url;
1718
+ if (type) script.type = type;
1719
+ script.onload = callback;
1720
+ doc.head.appendChild(script);
1762
1721
  };
1763
1722
  func.runtime.platform.load_css = function (href) {
1764
- if (typeof document === 'undefined') return;
1723
+ const doc = func.runtime.platform.get_document();
1724
+ if (!doc?.createElement || !doc?.head) {
1725
+ return;
1726
+ }
1765
1727
  try {
1766
- if (document.querySelector('link[href="' + href + '"]')) return;
1728
+ if (doc.querySelector('link[href="' + href + '"]')) return;
1767
1729
  } catch (err) {
1768
1730
  return;
1769
1731
  }
1770
- const link = document.createElement('link');
1732
+ const link = doc.createElement('link');
1771
1733
  link.rel = 'stylesheet';
1772
1734
  link.type = 'text/css';
1773
1735
  link.href = href;
1774
- document.head.insertBefore(link, document.head.firstChild);
1736
+ doc.head.insertBefore(link, doc.head.firstChild);
1775
1737
  };
1776
1738
  func.runtime.platform.remove_js_css = function (filename, filetype) {
1777
- if (typeof document === 'undefined') return;
1739
+ const doc = func.runtime.platform.get_document();
1740
+ if (!doc?.getElementsByTagName) return;
1778
1741
  const tagName = filetype === 'js' ? 'script' : filetype === 'css' ? 'link' : 'none';
1779
1742
  const attr = filetype === 'js' ? 'src' : filetype === 'css' ? 'href' : 'none';
1780
- const elements = document.getElementsByTagName(tagName);
1743
+ const elements = doc.getElementsByTagName(tagName);
1781
1744
  for (let i = elements.length - 1; i >= 0; i--) {
1782
1745
  if (elements[i] && elements[i].getAttribute(attr) != null && elements[i].getAttribute(attr).indexOf(filename) !== -1) {
1783
1746
  elements[i].parentNode.removeChild(elements[i]);
@@ -1785,15 +1748,17 @@ func.runtime.platform.remove_js_css = function (filename, filetype) {
1785
1748
  }
1786
1749
  };
1787
1750
  func.runtime.platform.inject_css = function (cssText) {
1788
- if (typeof document === 'undefined' || !cssText) return;
1789
- const style = document.createElement('style');
1751
+ const doc = func.runtime.platform.get_document();
1752
+ if (!doc?.createElement || !doc?.head?.appendChild || !cssText) return;
1753
+ const style = doc.createElement('style');
1790
1754
  style.type = 'text/css';
1791
1755
  style.textContent = cssText;
1792
- document.head.appendChild(style);
1756
+ doc.head.appendChild(style);
1793
1757
  };
1794
1758
  func.runtime.platform.set_title = function (title) {
1795
- if (typeof document !== 'undefined') {
1796
- document.title = title;
1759
+ const doc = func.runtime.platform.get_document();
1760
+ if (doc) {
1761
+ doc.title = title;
1797
1762
  }
1798
1763
  };
1799
1764
  func.runtime.platform.set_cursor = function (element, cursor) {
@@ -2481,12 +2446,36 @@ func.runtime.resources.load_cdn = async function (SESSION_ID, resource) {
2481
2446
  func.runtime.resources.get_plugin_manifest_entry = function (_session, plugin_name) {
2482
2447
  return APP_OBJ[_session.app_id]?.app_plugins_purchased?.[plugin_name] || null;
2483
2448
  };
2484
- func.runtime.resources.get_plugin_module_path = function (plugin, resource) {
2449
+ func.runtime.resources.get_plugin_resource_candidates = function (_session, plugin, resource) {
2485
2450
  const manifest_entry = plugin?.manifest?.[resource];
2486
- return `${manifest_entry?.dist ? 'dist/' : ''}${resource}`;
2451
+ const default_path = `${manifest_entry?.dist ? 'dist/' : ''}${resource}`;
2452
+ const candidates = [];
2453
+ if (_session?.worker_type === 'Dev' && manifest_entry?.dist && /\.mjs$/.test(resource)) {
2454
+ candidates.push(`src/${resource}`);
2455
+ }
2456
+ candidates.push(default_path);
2457
+ return Array.from(new Set(candidates.filter(Boolean)));
2458
+ };
2459
+ func.runtime.resources.get_plugin_module_path = function (plugin, resource, _session) {
2460
+ return func.runtime.resources.get_plugin_resource_candidates(_session, plugin, resource)[0] || resource;
2487
2461
  };
2488
2462
  func.runtime.resources.get_plugin_module_url = async function (SESSION_ID, plugin_name, plugin, resource) {
2489
- return await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, func.runtime.resources.get_plugin_module_path(plugin, resource));
2463
+ const _session = SESSION_OBJ[SESSION_ID];
2464
+ return await func.utils.get_plugin_npm_cdn(SESSION_ID, plugin_name, func.runtime.resources.get_plugin_module_path(plugin, resource, _session));
2465
+ };
2466
+ func.runtime.resources.import_plugin_module = async function (SESSION_ID, plugin_name, plugin, resource) {
2467
+ const _session = SESSION_OBJ[SESSION_ID];
2468
+ const candidates = func.runtime.resources.get_plugin_resource_candidates(_session, plugin, resource);
2469
+ let last_error = null;
2470
+ for (let index = 0; index < candidates.length; index++) {
2471
+ const candidate = candidates[index];
2472
+ try {
2473
+ return await func.utils.get_plugin_resource(SESSION_ID, plugin_name, candidate);
2474
+ } catch (error) {
2475
+ last_error = error;
2476
+ }
2477
+ }
2478
+ throw last_error || new Error(`plugin resource not found: ${plugin_name}/${resource}`);
2490
2479
  };
2491
2480
  func.runtime.resources.load_plugin_runtime_css = async function (SESSION_ID, plugin_name, plugin) {
2492
2481
  if (!plugin?.manifest?.['runtime.mjs']?.dist || !plugin?.manifest?.['runtime.mjs']?.css) {
@@ -2516,12 +2505,10 @@ func.runtime.resources.run_ui_plugin = async function (SESSION_ID, paramsP, $elm
2516
2505
 
2517
2506
  await func.runtime.resources.load_plugin_runtime_css(SESSION_ID, plugin_name, plugin);
2518
2507
 
2519
- const plugin_index_src = await func.runtime.resources.get_plugin_module_url(SESSION_ID, plugin_name, plugin, 'index.mjs');
2520
- const plugin_index_resources = await import(plugin_index_src);
2508
+ const plugin_index_resources = await func.runtime.resources.import_plugin_module(SESSION_ID, plugin_name, plugin, 'index.mjs');
2521
2509
  const properties = await func.runtime.resources.resolve_plugin_properties(SESSION_ID, paramsP.dsSessionP, value?.attributes, plugin_index_resources.properties);
2522
2510
 
2523
- const plugin_runtime_src = await func.runtime.resources.get_plugin_module_url(SESSION_ID, plugin_name, plugin, 'runtime.mjs');
2524
- const plugin_runtime_resources = await import(plugin_runtime_src);
2511
+ const plugin_runtime_resources = await func.runtime.resources.import_plugin_module(SESSION_ID, plugin_name, plugin, 'runtime.mjs');
2525
2512
 
2526
2513
  if (plugin_runtime_resources.cdn && Array.isArray(plugin_runtime_resources.cdn)) {
2527
2514
  for await (const resource of plugin_runtime_resources.cdn) {
@@ -2604,25 +2591,52 @@ func.runtime.widgets.get_fields_data = async function (context, fields, props) {
2604
2591
 
2605
2592
  return { code: return_code, data: data_obj };
2606
2593
  };
2594
+ func.runtime.widgets.get_resource_candidates = function (context, resource) {
2595
+ return func.runtime.resources.get_plugin_resource_candidates(context._session, context.plugin, resource);
2596
+ };
2597
+ func.runtime.widgets.normalize_capabilities = function (definition) {
2598
+ const capabilities = definition?.capabilities || {};
2599
+ return {
2600
+ browser: capabilities.browser !== false,
2601
+ headless: capabilities.headless === true,
2602
+ };
2603
+ };
2604
+ func.runtime.widgets.supports_current_environment = function (definition) {
2605
+ const capabilities = func.runtime.widgets.normalize_capabilities(definition);
2606
+ if (func.runtime.platform.has_document()) {
2607
+ return capabilities.browser !== false;
2608
+ }
2609
+ return !!capabilities.headless;
2610
+ };
2607
2611
  func.runtime.widgets.get_resource_path = function (context, resource) {
2612
+ const relative_path = func.runtime.widgets.get_resource_candidates(context, resource)[0] || resource;
2608
2613
  if (context._session.worker_type === 'Dev') {
2609
- return `../../plugins/${context.plugin_name}/${resource}`;
2614
+ return `../../plugins/${context.plugin_name}/${relative_path}`;
2610
2615
  }
2611
- const manifest_entry = context.plugin?.manifest?.[resource];
2612
- const dist_prefix = manifest_entry?.dist ? 'dist/' : '';
2613
- return `https://${context._session.domain}/plugins/${context.plugin_name}/${dist_prefix}${resource}?gtp_token=${context._session.gtp_token}&app_id=${context._session.app_id}`;
2616
+ return `https://${context._session.domain}/plugins/${context.plugin_name}/${relative_path}?gtp_token=${context._session.gtp_token}&app_id=${context._session.app_id}`;
2614
2617
  };
2615
2618
  func.runtime.widgets.load_css_style = function (context) {
2616
2619
  func.utils.load_css_on_demand(func.runtime.widgets.get_resource_path(context, 'style.css'));
2617
2620
  return true;
2618
2621
  };
2619
2622
  func.runtime.widgets.get_resource = async function (context, resource) {
2620
- const manifest_entry = context.plugin?.manifest?.[resource];
2621
- const path = `${manifest_entry?.dist ? 'dist/' : ''}${resource}`;
2622
- return await func.utils.get_plugin_resource(context.SESSION_ID, context.plugin_name, path);
2623
+ const candidates = func.runtime.widgets.get_resource_candidates(context, resource);
2624
+ let last_error = null;
2625
+ for (let index = 0; index < candidates.length; index++) {
2626
+ const candidate = candidates[index];
2627
+ try {
2628
+ return await func.utils.get_plugin_resource(context.SESSION_ID, context.plugin_name, candidate);
2629
+ } catch (error) {
2630
+ last_error = error;
2631
+ }
2632
+ }
2633
+ throw last_error || new Error(`widget resource not found: ${context.plugin_name}/${resource}`);
2634
+ };
2635
+ func.runtime.widgets.get_definition = async function (context) {
2636
+ return await func.runtime.widgets.get_resource(context, 'index.mjs');
2623
2637
  };
2624
2638
  func.runtime.widgets.get_methods = async function (context) {
2625
- const index = await func.runtime.widgets.get_resource(context, 'index.mjs');
2639
+ const index = await func.runtime.widgets.get_definition(context);
2626
2640
  return index?.methods || {};
2627
2641
  };
2628
2642
  func.runtime.widgets.load_runtime_css = async function (context) {
@@ -2633,7 +2647,7 @@ func.runtime.widgets.load_runtime_css = async function (context) {
2633
2647
  func.utils.load_css_on_demand(plugin_runtime_css_url);
2634
2648
  return true;
2635
2649
  };
2636
- func.runtime.widgets.build_params = function (context, $containerP, plugin_setup, api_utils, extra = {}) {
2650
+ func.runtime.widgets.build_params = function (context, container_node, container_data, plugin_setup, api_utils, extra = {}) {
2637
2651
  return {
2638
2652
  SESSION_ID: context.SESSION_ID,
2639
2653
  method: context.method,
@@ -2642,14 +2656,28 @@ func.runtime.widgets.build_params = function (context, $containerP, plugin_setup
2642
2656
  sourceP: context.sourceP,
2643
2657
  propsP: context.propsP,
2644
2658
  plugin_name: context.plugin_name,
2645
- $containerP,
2659
+ container_node,
2660
+ container_data,
2646
2661
  plugin_setup,
2647
2662
  report_error: function (descP, warn) {
2648
2663
  return func.runtime.widgets.report_error(context, descP, warn);
2649
2664
  },
2665
+ log_error: function (descP, warn) {
2666
+ return func.runtime.widgets.report_error(context, descP, warn);
2667
+ },
2650
2668
  call_plugin_api: async function (plugin_nameP, dataP) {
2651
2669
  return await func.utils.call_plugin_api(context.SESSION_ID, plugin_nameP, dataP);
2652
2670
  },
2671
+ set_SYS_GLOBAL_OBJ_WIDGET_INFO: async function (docP) {
2672
+ return await func.utils.set_SYS_GLOBAL_OBJ_WIDGET_INFO(context.SESSION_ID, docP);
2673
+ },
2674
+ run_widgetCallbackEvent: async function () {
2675
+ const event_id = context.propsP?.widgetCallbackEvent;
2676
+ if (!event_id || !api_utils?.invoke_event) {
2677
+ return false;
2678
+ }
2679
+ return await api_utils.invoke_event(event_id);
2680
+ },
2653
2681
  api_utils,
2654
2682
  ...extra,
2655
2683
  };
@@ -3739,6 +3767,18 @@ func.common.fastHash = function (inputString) {
3739
3767
  };
3740
3768
 
3741
3769
  glb.new_xu_render = false;
3770
+ func.runtime = func.runtime || {};
3771
+ func.runtime.platform = func.runtime.platform || {};
3772
+
3773
+ func.runtime.platform.dispatch_document_event = function (name, data) {
3774
+ if (typeof document === 'undefined' || typeof CustomEvent === 'undefined') {
3775
+ return false;
3776
+ }
3777
+ document.dispatchEvent(new CustomEvent(name, {
3778
+ detail: Array.isArray(data) ? data : [data],
3779
+ }));
3780
+ return true;
3781
+ };
3742
3782
  glb.DEBUG_INFO_OBJ = {};
3743
3783
  // var CONNECTION_ATTEMPTS = 0;
3744
3784
  glb.APP_INFO = {};
@@ -9239,7 +9279,7 @@ func.runtime.ui.find_element_data_in_root = function (SESSION_ID, dataKey, prope
9239
9279
  }
9240
9280
  return func.runtime.ui.find_in_root(SESSION_ID, '[xu-panel-wrapper-id]');
9241
9281
  }
9242
- return func.UI.utils.find_in_element_data(dataKey, func.runtime.ui.as_jquery(func.runtime.ui.get_root_element(SESSION_ID)), property, value);
9282
+ return func.UI.utils.find_in_element_data(dataKey, func.runtime.ui.get_root_element(SESSION_ID), property, value);
9243
9283
  };
9244
9284
  func.runtime.ui.find_element_data_in_parent = function ($container, dataKey, property, value) {
9245
9285
  const container_node = func.runtime.ui.get_first_node($container);
@@ -9253,7 +9293,7 @@ func.runtime.ui.find_element_data_in_parent = function ($container, dataKey, pro
9253
9293
  }
9254
9294
  return func.runtime.ui.find_by_selector(parent_node, `[xu-ui-id="${value}"]`);
9255
9295
  }
9256
- return func.UI.utils.find_in_element_data(dataKey, func.runtime.ui.as_jquery(parent_node), property, value);
9296
+ return func.UI.utils.find_in_element_data(dataKey, func.runtime.ui._wrap_matches([parent_node]), property, value);
9257
9297
  };
9258
9298
  func.runtime.ui.sync_child_parent_container = function ($div) {
9259
9299
  const div_node = func.runtime.ui.get_first_node($div);
@@ -9360,40 +9400,14 @@ func.runtime.ui.clear_screen_blockers = function () {
9360
9400
  }
9361
9401
  };
9362
9402
 
9363
- // @deprecated — no-op shim now that jQuery is removed from the bundle.
9364
9403
  func.runtime.ui.as_jquery = function (target) {
9365
- if (target?.jquery) {
9366
- return target;
9367
- }
9368
9404
  const node = func.runtime.ui.get_first_node(target);
9369
- // Return a minimal jQuery-like wrapper so legacy callers don't crash.
9370
- const _node_data = {};
9371
- const _arr = node ? [node] : [];
9372
- return {
9373
- 0: node,
9374
- length: _arr.length,
9375
- toArray: function () { return _arr.slice(); },
9376
- data: function (key, value) {
9377
- if (typeof key === 'undefined') return _node_data;
9378
- if (typeof value !== 'undefined') { _node_data[key] = value; return this; }
9379
- return _node_data[key];
9380
- },
9381
- attr: function (key, value) {
9382
- if (!node) return undefined;
9383
- if (typeof value !== 'undefined') { node.setAttribute(key, value); return this; }
9384
- return node?.getAttribute?.(key);
9385
- },
9386
- removeData: function () { for (const k in _node_data) delete _node_data[k]; return this; },
9387
- children: function () { return { toArray: function () { return node ? Array.from(node.children) : []; } }; },
9388
- };
9405
+ return func.runtime.ui._wrap_matches(node ? [node] : []);
9389
9406
  };
9390
9407
  func.runtime.ui.get_first_node = function (target) {
9391
9408
  if (!target) {
9392
9409
  return null;
9393
9410
  }
9394
- if (target?.jquery) {
9395
- return target[0] || null;
9396
- }
9397
9411
  if (target?.nodeType) {
9398
9412
  return target;
9399
9413
  }
@@ -9411,9 +9425,10 @@ func.runtime.ui.get_data = function (target) {
9411
9425
  if (meta) return meta;
9412
9426
  }
9413
9427
  }
9414
- // fallback: store per-element data on the node itself
9415
9428
  if (target_node) {
9416
- if (!target_node.__xuData) target_node.__xuData = {};
9429
+ if (!target_node.__xuData) {
9430
+ target_node.__xuData = {};
9431
+ }
9417
9432
  return target_node.__xuData;
9418
9433
  }
9419
9434
  return {};
@@ -12851,7 +12866,7 @@ func.runtime.ui.ensure_nav = function (SESSION_ID, $container) {
12851
12866
  }
12852
12867
  var nav_el = document.createElement('xu-nav');
12853
12868
  func.runtime.ui.append($container, nav_el);
12854
- var $nav = func.runtime.ui.as_jquery(nav_el);
12869
+ var $nav = func.runtime.ui._wrap_matches([nav_el]);
12855
12870
  func.UI.component.init_xu_nav($container, $nav);
12856
12871
  return $nav;
12857
12872
  };
@@ -13681,7 +13696,7 @@ func.runtime.ui._to_node_array = func.runtime.ui._to_node_array || function (inp
13681
13696
  if (!input) {
13682
13697
  return [];
13683
13698
  }
13684
- if (input.jquery) {
13699
+ if (typeof input?.toArray === 'function' && typeof input?.length === 'number' && !input?.nodeType) {
13685
13700
  return input.toArray();
13686
13701
  }
13687
13702
  if (Array.isArray(input)) {
@@ -16497,7 +16512,12 @@ func.runtime.widgets.render_node = async function (options) {
16497
16512
  return func.runtime.widgets.report_error(widget_context, descP, warn);
16498
16513
  };
16499
16514
 
16500
- const methods = await func.runtime.widgets.get_methods(widget_context);
16515
+ const definition = await func.runtime.widgets.get_definition(widget_context);
16516
+ if (!func.runtime.widgets.supports_current_environment(definition)) {
16517
+ return report_error(`plugin ${plugin_name} is not available in the current environment`, true);
16518
+ }
16519
+
16520
+ const methods = definition?.methods || {};
16501
16521
  if (methods && !methods[method]) {
16502
16522
  return report_error('method not found');
16503
16523
  }
@@ -16558,7 +16578,13 @@ func.runtime.widgets.render_node = async function (options) {
16558
16578
  job_id: options.jobNoP,
16559
16579
  });
16560
16580
 
16561
- const params = func.runtime.widgets.build_params(widget_context, $div, plugin_setup_ret.data, api_utils);
16581
+ const params = func.runtime.widgets.build_params(
16582
+ widget_context,
16583
+ func.runtime.ui.get_first_node($div),
16584
+ func.runtime.ui.get_data($div),
16585
+ plugin_setup_ret.data,
16586
+ api_utils,
16587
+ );
16562
16588
  const fx = await func.runtime.widgets.get_resource(widget_context, 'runtime.mjs');
16563
16589
 
16564
16590
  await func.runtime.widgets.load_runtime_css(widget_context);
@@ -17588,7 +17614,7 @@ func.runtime.render.handle_xu_ref = async function (options) {
17588
17614
  func.runtime.render.handle_xu_bind = async function (options) {
17589
17615
  if (options.is_skeleton) return {};
17590
17616
 
17591
- const $elm = func.runtime?.ui?.get_preferred_live_element ? func.runtime.ui.get_preferred_live_element(options.$elm) : func.runtime.ui.as_jquery(options.$elm);
17617
+ const $elm = func.runtime?.ui?.get_preferred_live_element ? func.runtime.ui.get_preferred_live_element(options.$elm) : options.$elm;
17592
17618
  const elm_data = func.runtime.ui.get_data($elm);
17593
17619
  const xuData = elm_data?.xuData;
17594
17620
  const bind_expression =