@yuneta/gobj-ui 7.26.6 → 7.26.8

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.
Files changed (48) hide show
  1. package/README.md +74 -25
  2. package/dist/gobj-ui.cjs.js +967 -377
  3. package/dist/gobj-ui.es.js +967 -377
  4. package/index.js +5 -1
  5. package/package.json +2 -2
  6. package/src/c_g6_nodes_tree.js +69 -24
  7. package/src/c_yui_form.js +331 -140
  8. package/src/c_yui_gclass.js +26 -21
  9. package/src/c_yui_gobj_tree_js.js +16 -5
  10. package/src/c_yui_json.js +7 -6
  11. package/src/c_yui_json_graph.js +42 -14
  12. package/src/c_yui_json_pad.js +2 -1
  13. package/src/c_yui_map.js +139 -75
  14. package/src/c_yui_nav.js +60 -20
  15. package/src/c_yui_pager.js +14 -9
  16. package/src/c_yui_period.js +16 -6
  17. package/src/c_yui_schema_editor.js +3 -2
  18. package/src/c_yui_shell.js +96 -31
  19. package/src/c_yui_treedb_topic_with_form.js +50 -56
  20. package/src/c_yui_treedb_topics.js +8 -7
  21. package/src/c_yui_uplot.js +1 -1
  22. package/src/c_yui_window.js +123 -36
  23. package/src/c_yui_window_manager.js +8 -3
  24. package/src/c_yui_wizard.js +23 -8
  25. package/src/delete_impact.js +5 -3
  26. package/src/form_json_field.js +123 -0
  27. package/src/form_json_field.test.js +49 -0
  28. package/src/form_json_field.wiring.test.js +137 -0
  29. package/src/form_table_rearm.wiring.test.js +158 -0
  30. package/src/g6_event_kw.js +36 -0
  31. package/src/nav_cards_helpers.js +2 -1
  32. package/src/nav_cards_helpers.test.js +7 -3
  33. package/src/schema_to_c.js +27 -1
  34. package/src/schema_to_c.test.js +15 -1
  35. package/src/shell_modals.js +5 -3
  36. package/src/shell_route_map.js +18 -13
  37. package/src/treedb_topics_transport.wiring.test.js +35 -1
  38. package/src/vite_plugin_yuneta_html.test.js +79 -0
  39. package/src/window_show.wiring.test.js +83 -0
  40. package/src/window_veto_back.wiring.test.js +136 -0
  41. package/src/wizard_chrome.wiring.test.js +87 -0
  42. package/src/yui_dev.js +23 -14
  43. package/src/yui_frontend_view.js +4 -4
  44. package/src/yui_gclass_view.js +3 -3
  45. package/src/yui_table_filter_clear.js +44 -44
  46. package/src/yui_text.js +31 -0
  47. package/src/yui_text.test.js +39 -0
  48. package/vite-plugin-yuneta-html.js +36 -9
@@ -1049,6 +1049,7 @@ function mt_stop$20(gobj) {
1049
1049
  st.items = {};
1050
1050
  st.active_route = null;
1051
1051
  }
1052
+ (0, _yuneta_gobj_js.gobj_stop_children)(gobj);
1052
1053
  }
1053
1054
  /***************************************************************
1054
1055
  * Framework Method: Destroy
@@ -1841,7 +1842,7 @@ function build_toolbar_action_item(gobj, it) {
1841
1842
  btn_attrs["aria-haspopup"] = "menu";
1842
1843
  btn_attrs["aria-expanded"] = "false";
1843
1844
  }
1844
- let tip = it.tooltip || it.aria_label;
1845
+ let tip = it.tooltip || i18n_aria;
1845
1846
  if (tip) {
1846
1847
  btn_attrs.title = tip;
1847
1848
  btn_attrs["data-i18n-title"] = tip;
@@ -1894,6 +1895,11 @@ function build_toolbar_brand_item(gobj, it) {
1894
1895
  Object.assign(attrs, link);
1895
1896
  } else if (action_type === "") tag = "div";
1896
1897
  else attrs.type = "button";
1898
+ let tip = it.tooltip || i18n_aria;
1899
+ if (tag !== "div" && tip) {
1900
+ attrs.title = tip;
1901
+ attrs["data-i18n-title"] = tip;
1902
+ }
1897
1903
  let $item = (0, _yuneta_gobj_js.createElement2)([
1898
1904
  tag,
1899
1905
  attrs,
@@ -1938,7 +1944,7 @@ function build_toolbar_avatar_item(gobj, it) {
1938
1944
  attrs["aria-haspopup"] = "menu";
1939
1945
  attrs["aria-expanded"] = "false";
1940
1946
  }
1941
- let tip = it.tooltip || it.aria_label;
1947
+ let tip = it.tooltip || i18n_aria;
1942
1948
  if (tip) {
1943
1949
  attrs.title = tip;
1944
1950
  attrs["data-i18n-title"] = tip;
@@ -2010,7 +2016,7 @@ function build_toolbar_connection_item(gobj, it) {
2010
2016
  "aria-label": aria_key,
2011
2017
  "data-i18n-aria-label": i18n_aria
2012
2018
  };
2013
- let tip = it.tooltip || it.aria_label;
2019
+ let tip = it.tooltip || i18n_aria;
2014
2020
  if (tip) {
2015
2021
  attrs.title = tip;
2016
2022
  attrs["data-i18n-title"] = tip;
@@ -2143,6 +2149,11 @@ function open_toolbar_dropdown(gobj, item, action, $trigger) {
2143
2149
  $panel.style.right = "auto";
2144
2150
  $panel.style.left = `${Math.round(left)}px`;
2145
2151
  }
2152
+ let max_h = window.innerHeight - Math.max(0, pos.top) - margin;
2153
+ if (max_h > 0) {
2154
+ $panel.style.maxHeight = `${Math.round(max_h)}px`;
2155
+ $panel.style.overflowY = "auto";
2156
+ }
2146
2157
  yui_shell_translate(gobj, $panel);
2147
2158
  let backdrop = (ev) => {
2148
2159
  if ($panel.contains(ev.target)) return;
@@ -2150,7 +2161,10 @@ function open_toolbar_dropdown(gobj, item, action, $trigger) {
2150
2161
  close_toolbar_dropdown(gobj);
2151
2162
  };
2152
2163
  document.addEventListener("mousedown", backdrop, true);
2153
- let dismiss = () => close_toolbar_dropdown(gobj);
2164
+ let dismiss = (ev) => {
2165
+ if (ev && ev.type === "scroll" && ev.target && ev.target !== document && $panel.contains(ev.target)) return;
2166
+ close_toolbar_dropdown(gobj);
2167
+ };
2154
2168
  document.addEventListener("scroll", dismiss, {
2155
2169
  capture: true,
2156
2170
  passive: true
@@ -2249,7 +2263,11 @@ function build_dropdown_row(gobj, sub, idx) {
2249
2263
  "data-dropdown-item-id": sub.id || "",
2250
2264
  "aria-label": aria_key
2251
2265
  };
2252
- if (i18n_aria) attrs["data-i18n-aria-label"] = i18n_aria;
2266
+ if (i18n_aria) {
2267
+ attrs["data-i18n-aria-label"] = i18n_aria;
2268
+ attrs.title = i18n_aria;
2269
+ attrs["data-i18n-title"] = i18n_aria;
2270
+ }
2253
2271
  let $btn = (0, _yuneta_gobj_js.createElement2)([
2254
2272
  "button",
2255
2273
  attrs,
@@ -2311,7 +2329,10 @@ function drawers(gobj, menu_id) {
2311
2329
  ************************************************************/
2312
2330
  function push_escape(gobj, layer, handler) {
2313
2331
  let priv = gobj.priv;
2314
- if (!priv || !priv.escape_stack) return;
2332
+ if (!priv || !priv.escape_stack) {
2333
+ (0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: push_escape('${layer}') on a shell that is gone: Escape will not close it`);
2334
+ return;
2335
+ }
2315
2336
  priv.escape_stack.push({
2316
2337
  layer,
2317
2338
  handler
@@ -2367,9 +2388,11 @@ function pop_escape(gobj, handler) {
2367
2388
  function drain_overlays(gobj) {
2368
2389
  let priv = gobj.priv;
2369
2390
  if (!priv || !priv.overlay_stack) return;
2391
+ let entries = priv.overlay_stack.splice(0);
2370
2392
  let kept = [];
2371
- while (priv.overlay_stack.length > 0) {
2372
- let entry = priv.overlay_stack.pop();
2393
+ while (entries.length > 0) {
2394
+ let entry = entries.pop();
2395
+ if (entry.dismissed) continue;
2373
2396
  if (entry.keep_on_navigate) {
2374
2397
  kept.unshift(entry);
2375
2398
  continue;
@@ -2380,7 +2403,7 @@ function drain_overlays(gobj) {
2380
2403
  (0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: overlay close on navigation failed: ${e}`);
2381
2404
  }
2382
2405
  }
2383
- for (let entry of kept) priv.overlay_stack.push(entry);
2406
+ priv.overlay_stack.unshift(...kept);
2384
2407
  }
2385
2408
  function retag_overlay_hash(gobj, st, hash) {
2386
2409
  let priv = gobj.priv;
@@ -2410,6 +2433,7 @@ function push_overlay_history(gobj, close, opts) {
2410
2433
  function overlay_dismissed(gobj, entry) {
2411
2434
  let priv = gobj.priv;
2412
2435
  if (!priv || !priv.overlay_stack || !entry) return;
2436
+ entry.dismissed = true;
2413
2437
  let idx = priv.overlay_stack.indexOf(entry);
2414
2438
  if (idx < 0) return;
2415
2439
  priv.overlay_stack.splice(idx, 1);
@@ -2519,7 +2543,10 @@ function update_secondary_nav_visibility(gobj, entry) {
2519
2543
  ************************************************************/
2520
2544
  function ac_nav_clicked(gobj, event, kw, src) {
2521
2545
  let route = kw && kw.route || "";
2522
- if ((0, _yuneta_gobj_js.empty_string)(route)) return 0;
2546
+ if ((0, _yuneta_gobj_js.empty_string)(route)) {
2547
+ (0, _yuneta_gobj_js.log_warning)(`C_YUI_SHELL: ${event} with no route, from ${(0, _yuneta_gobj_js.gobj_short_name)(src)}`);
2548
+ return -1;
2549
+ }
2523
2550
  route = remembered_position(gobj, route);
2524
2551
  if ((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "use_hash") && !route_restores_url(gobj, route)) {
2525
2552
  let target_hash = route_to_hash(route);
@@ -2557,17 +2584,19 @@ function ac_nav_item_close(gobj, event, kw, src) {
2557
2584
  * FSM
2558
2585
  ***************************************************************/
2559
2586
  /***************************************************************
2560
- * EV_CONNECTION_STATE is an OPTIONAL fact: a view that waits for a
2561
- * backend answer subscribes to it by name. An app that subscribed
2562
- * to EVERY event of its shell with one attr (`subscriber`) did not
2563
- * ask for it and does not declare it -- published to it anyway, the
2564
- * event would be an FSM error in the app on every connection edge,
2565
- * and adding it to the shell a breaking change for every such app.
2566
- * So it reaches only the subscribers that declare it. Every other
2567
- * event of the shell goes out as before.
2587
+ * EV_CONNECTION_STATE and EV_ICONS_CHANGED are OPTIONAL facts: a
2588
+ * view that needs one subscribes to it by name. An app that
2589
+ * subscribed to EVERY event of its shell with one attr
2590
+ * (`subscriber`) did not ask for them and does not declare them --
2591
+ * published to it anyway, each would be an FSM error in the app
2592
+ * every time it fires, and adding one to the shell a breaking
2593
+ * change for every such app (7.26.6 did exactly that with
2594
+ * EV_ICONS_CHANGED). So they reach only the subscribers that
2595
+ * declare them. Every other event of the shell goes out as before.
2568
2596
  ***************************************************************/
2597
+ var OPTIONAL_EVENTS = /* @__PURE__ */ new Set(["EV_CONNECTION_STATE", "EV_ICONS_CHANGED"]);
2569
2598
  function mt_publication_pre_filter(gobj, subs, event, kw) {
2570
- if (event !== "EV_CONNECTION_STATE") return 1;
2599
+ if (!OPTIONAL_EVENTS.has(event)) return 1;
2571
2600
  let subscriber = subs && subs.subscriber;
2572
2601
  if (!subscriber || !(0, _yuneta_gobj_js.gobj_has_event)(subscriber, event, 0)) return 0;
2573
2602
  return 1;
@@ -2899,7 +2928,7 @@ function yui_shell_set_translator(shell_gobj, t) {
2899
2928
  *
2900
2929
  * The division of labour, unchanged: LIBRARY-built DOM is
2901
2930
  * translated through here; APP view gclasses translate their own
2902
- * DOM (they own a `t` — see mount_view).
2931
+ * DOM (they own a `t` — see build_view_gobj).
2903
2932
  *
2904
2933
  * Silent no-op with no shell or no translator: an app that never
2905
2934
  * registered one keeps the previous behaviour instead of losing
@@ -3003,6 +3032,35 @@ function yui_shell_close_dropdown(shell_gobj) {
3003
3032
  close_toolbar_dropdown(shell_gobj);
3004
3033
  }
3005
3034
  //#endregion
3035
+ //#region src/yui_text.js
3036
+ /***********************************************************************
3037
+ * yui_text.js
3038
+ *
3039
+ * DATA as text for createElement2().
3040
+ *
3041
+ * createElement2() takes a string content that starts with '<' for
3042
+ * MARKUP and parses it (that is how a component passes an inline
3043
+ * icon). So a value that came from outside -- a backend answer, a
3044
+ * treedb node, a name somebody typed, a frame of the traffic -- must
3045
+ * never go in as a bare string: "<img src=x onerror=...>" would run.
3046
+ * It goes in as a Text node, which is always text.
3047
+ *
3048
+ * Trimmed like createElement2() trims a string, so the change of
3049
+ * form does not change what is shown. A Text node under an
3050
+ * `i18n`/`data-i18n` element is still re-translated by
3051
+ * refresh_language(), which sets textContent.
3052
+ *
3053
+ * Copyright (c) 2026, ArtGins.
3054
+ * All Rights Reserved.
3055
+ ***********************************************************************/
3056
+ /************************************************************
3057
+ * A Text node with `value` as its text ("" for null/undefined).
3058
+ ************************************************************/
3059
+ function text_node(value) {
3060
+ if (value === null || value === void 0) return document.createTextNode("");
3061
+ return document.createTextNode(String(value).trim());
3062
+ }
3063
+ //#endregion
3006
3064
  //#region src/shell_modals.js
3007
3065
  /***********************************************************************
3008
3066
  * shell_modals.js
@@ -3115,7 +3173,7 @@ function show_notification(shell, kind, message, opts) {
3115
3173
  ...p_attrs,
3116
3174
  class: "TOAST_MSG"
3117
3175
  },
3118
- message
3176
+ typeof message === "string" ? text_node(message) : message
3119
3177
  ]]
3120
3178
  ]);
3121
3179
  $layer.appendChild($note);
@@ -3217,7 +3275,7 @@ function yui_shell_show_modal(shell, content, opts) {
3217
3275
  (title_prefix ? [[
3218
3276
  "span",
3219
3277
  { class: "MODAL_TITLE_PREFIX" },
3220
- title_prefix
3278
+ text_node(title_prefix)
3221
3279
  ]] : []).concat(title ? [[
3222
3280
  "span",
3223
3281
  {
@@ -3375,7 +3433,7 @@ function build_dialog(shell, message, buttons, opts) {
3375
3433
  class: "CONFIRM_MSG yui-confirm-msg",
3376
3434
  i18n: message
3377
3435
  },
3378
- message
3436
+ text_node(message)
3379
3437
  ]] : [message];
3380
3438
  let $footer_children = buttons.map((b) => {
3381
3439
  let cls = "CONFIRM_BTN button px-5";
@@ -3576,7 +3634,7 @@ function yui_shell_confirm_yesnocancel(shell, message, opts) {
3576
3634
  *
3577
3635
  * Window - position fixed
3578
3636
  *
3579
- * Copyright (c) 2025, ArtGins.
3637
+ * Copyright (c) 2025-2026, ArtGins.
3580
3638
  * All Rights Reserved.
3581
3639
  ***********************************************************************/
3582
3640
  /***************************************************************
@@ -3618,9 +3676,9 @@ var attrs_table$21 = [
3618
3676
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "title_prefix", 0, "", "Optional DATA half of the title (a topic/service/marker name), shown before `title` and never translated. Use it instead of composing `${name} · ${t(key)}` into `title`, which cannot re-translate"),
3619
3677
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "title", 0, "", "Window title, an i18n KEY: painted in the title bar (unless `header` overrides it) and on the dock chip. Pass the key, not t(key), or it cannot re-translate"),
3620
3678
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "icon", 0, "", "Window icon (by window type), leading the title bar and the dock chip: a yi-* class name or inline SVG"),
3621
- (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "focus", 0, null, "Brings focus to the element, can be a number or selector"),
3622
- (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "modal", 0, false, "Enable modal mode"),
3623
- (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "keyboard", 0, true, "Close window on ESC if not modal"),
3679
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "focus", 0, null, "NOT implemented yet: would bring focus to the element, a number or a selector"),
3680
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "modal", 0, false, "NOT implemented yet: would enable modal mode"),
3681
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "keyboard", 0, true, "NOT implemented yet: would close the window on ESC (Escape does nothing today)"),
3624
3682
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "back_dismissable", 0, true, "Browser Back closes this window (floating overlays only; ignored when it has a `manager`)"),
3625
3683
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "keep_on_navigate", 0, false, "This window is a navigation PANEL: a route change does not close it"),
3626
3684
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "back_overlay", 0, null, "Internal: overlay-history entry (Back-button integration)"),
@@ -3659,15 +3717,7 @@ function mt_create$21(gobj) {
3659
3717
  title_prefix: (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "title_prefix") || "",
3660
3718
  icon: (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "icon") || ""
3661
3719
  }, gobj);
3662
- } else if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "back_dismissable")) {
3663
- let shell = yui_shell_of(gobj);
3664
- if (shell) {
3665
- let overlay = yui_shell_register_overlay(shell, function() {
3666
- close_window(gobj);
3667
- }, { keep_on_navigate: (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "keep_on_navigate") });
3668
- (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "back_overlay", overlay);
3669
- }
3670
- }
3720
+ } else if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "back_dismissable")) register_back_overlay(gobj);
3671
3721
  let on_win_resize = function() {
3672
3722
  handleResize(gobj);
3673
3723
  };
@@ -3787,7 +3837,7 @@ function build_default_header(gobj) {
3787
3837
  if (!(0, _yuneta_gobj_js.empty_string)(prefix)) items.push([
3788
3838
  "span",
3789
3839
  { class: "WINDOW_TITLE_PREFIX has-text-weight-semibold" },
3790
- prefix
3840
+ text_node(prefix)
3791
3841
  ]);
3792
3842
  if (!(0, _yuneta_gobj_js.empty_string)(title)) items.push([
3793
3843
  "span",
@@ -3830,7 +3880,9 @@ function resolve_manager(gobj) {
3830
3880
  let m = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "manager");
3831
3881
  if (!m) return null;
3832
3882
  if (typeof m === "string") {
3833
- m = (0, _yuneta_gobj_js.gobj_find_service)(m, false) || null;
3883
+ let name = m;
3884
+ m = (0, _yuneta_gobj_js.gobj_find_service)(name, false) || null;
3885
+ if (!m) (0, _yuneta_gobj_js.log_warning)(`${GCLASS_NAME$21}: window manager '${name}' not found: no dock, no minimize`);
3834
3886
  (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "manager", m);
3835
3887
  }
3836
3888
  return m;
@@ -3940,6 +3992,8 @@ function build_ui$18(gobj) {
3940
3992
  {
3941
3993
  class: "WINDOW_MIN yui-wc wc-min",
3942
3994
  type: "button",
3995
+ title: (0, i18next.t)("minimize"),
3996
+ "data-i18n-title": "minimize",
3943
3997
  "aria-label": (0, i18next.t)("minimize"),
3944
3998
  "data-i18n-aria-label": "minimize",
3945
3999
  style: (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "showMin") && (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "manager") ? "" : "display:none;"
@@ -3955,6 +4009,8 @@ function build_ui$18(gobj) {
3955
4009
  {
3956
4010
  class: "WINDOW_MAX yui-wc wc-max",
3957
4011
  type: "button",
4012
+ title: (0, i18next.t)("maximize"),
4013
+ "data-i18n-title": "maximize",
3958
4014
  "aria-label": (0, i18next.t)("maximize"),
3959
4015
  "data-i18n-aria-label": "maximize",
3960
4016
  style: (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "showMax") ? "" : "display:none;"
@@ -3970,13 +4026,15 @@ function build_ui$18(gobj) {
3970
4026
  {
3971
4027
  class: "WINDOW_CLOSE yui-wc wc-close",
3972
4028
  type: "button",
4029
+ title: (0, i18next.t)("close"),
4030
+ "data-i18n-title": "close",
3973
4031
  "aria-label": (0, i18next.t)("close"),
3974
4032
  "data-i18n-aria-label": "close"
3975
4033
  },
3976
4034
  WC_CLOSE,
3977
4035
  { click: (evt) => {
3978
4036
  evt.stopPropagation();
3979
- close_window(gobj);
4037
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CLOSE_WINDOW", {}, gobj);
3980
4038
  } }
3981
4039
  ]
3982
4040
  ]
@@ -4112,7 +4170,37 @@ function destroy_ui$13(gobj) {
4112
4170
  }
4113
4171
  }
4114
4172
  /************************************************************
4173
+ * Register this floating window in the shell's overlay history,
4174
+ * so the browser Back closes it.
4115
4175
  *
4176
+ * The shell takes the entry off its stack BEFORE it calls the
4177
+ * close function (Back, or a route change draining overlays). When
4178
+ * a subscriber of EV_WINDOW_TO_CLOSE vetoes the close, the window
4179
+ * stays up with no entry: Back would no longer close it, and it
4180
+ * would float over the next views. So a window that survives its
4181
+ * own close function registers again.
4182
+ ************************************************************/
4183
+ function register_back_overlay(gobj) {
4184
+ let shell = yui_shell_of(gobj);
4185
+ if (!shell) return;
4186
+ const rearm = function() {
4187
+ if (!(0, _yuneta_gobj_js.gobj_is_destroying)(gobj) && !(0, _yuneta_gobj_js.gobj_read_attr)(gobj, "back_overlay")) register_back_overlay(gobj);
4188
+ };
4189
+ let overlay = yui_shell_register_overlay(shell, function() {
4190
+ (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "back_overlay", null);
4191
+ const closing = close_window(gobj);
4192
+ if (closing.state === "vetoed") rearm();
4193
+ else if (closing.state === "asking") closing.answer.then(rearm);
4194
+ }, { keep_on_navigate: (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "keep_on_navigate") });
4195
+ (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "back_overlay", overlay);
4196
+ }
4197
+ /************************************************************
4198
+ * Ask to close the window. Answers what happened:
4199
+ * {state: "closed"} the window is destroyed
4200
+ * {state: "vetoed"} a subscriber kept it open
4201
+ * {state: "asking", answer} a subscriber asked a question
4202
+ * first; `answer` resolves to
4203
+ * it once it is over
4116
4204
  ************************************************************/
4117
4205
  function close_window(gobj) {
4118
4206
  let kw_close = { abort_close: false };
@@ -4123,19 +4211,26 @@ function close_window(gobj) {
4123
4211
  if ((0, _yuneta_gobj_js.gobj_is_running)(gobj)) (0, _yuneta_gobj_js.gobj_stop)(gobj);
4124
4212
  (0, _yuneta_gobj_js.gobj_stop_children)(gobj);
4125
4213
  (0, _yuneta_gobj_js.gobj_destroy)(gobj);
4126
- } else if (kw_close.warning) yui_shell_confirm_yesnocancel(yui_shell_of(gobj), kw_close.warning, {
4127
- t: i18next.t,
4128
- yes_label: "yes",
4129
- no_label: "no",
4130
- cancel_label: "cancel"
4131
- }).then(function(answer) {
4132
- if (answer === "yes") {
4214
+ return { state: "closed" };
4215
+ }
4216
+ if (!kw_close.warning) return { state: "vetoed" };
4217
+ return {
4218
+ state: "asking",
4219
+ answer: yui_shell_confirm_yesnocancel(yui_shell_of(gobj), kw_close.warning, {
4220
+ t: i18next.t,
4221
+ yes_label: "yes",
4222
+ no_label: "no",
4223
+ cancel_label: "cancel"
4224
+ }).then(function(answer) {
4225
+ if (answer !== "yes") return answer;
4226
+ if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return answer;
4133
4227
  if (on_close) on_close();
4134
- (0, _yuneta_gobj_js.gobj_stop)(gobj);
4228
+ if ((0, _yuneta_gobj_js.gobj_is_running)(gobj)) (0, _yuneta_gobj_js.gobj_stop)(gobj);
4135
4229
  (0, _yuneta_gobj_js.gobj_stop_children)(gobj);
4136
4230
  (0, _yuneta_gobj_js.gobj_destroy)(gobj);
4137
- }
4138
- });
4231
+ return answer;
4232
+ })
4233
+ };
4139
4234
  }
4140
4235
  /************************************************************
4141
4236
  *
@@ -4169,8 +4264,12 @@ function set_max_icon(gobj, maximized) {
4169
4264
  if (!$container) return;
4170
4265
  let $btn = $container.querySelector(".wc-max");
4171
4266
  if ($btn) {
4267
+ let key = maximized ? "restore" : "maximize";
4172
4268
  $btn.innerHTML = maximized ? WC_RESTORE : WC_MAX;
4173
- $btn.setAttribute("aria-label", maximized ? "restore" : "maximize");
4269
+ $btn.setAttribute("title", (0, i18next.t)(key));
4270
+ $btn.setAttribute("data-i18n-title", key);
4271
+ $btn.setAttribute("aria-label", (0, i18next.t)(key));
4272
+ $btn.setAttribute("data-i18n-aria-label", key);
4174
4273
  }
4175
4274
  }
4176
4275
  /************************************************************
@@ -4392,6 +4491,19 @@ function ac_refresh$11(gobj, event, kw, src) {
4392
4491
  *
4393
4492
  ************************************************************/
4394
4493
  function ac_show$15(gobj, event, kw, src) {
4494
+ let manager = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "manager");
4495
+ if (manager) {
4496
+ (0, _yuneta_gobj_js.gobj_send_event)(manager, "EV_FOCUS_WINDOW", { window: gobj }, gobj);
4497
+ return 0;
4498
+ }
4499
+ let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
4500
+ if (!$container) {
4501
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: EV_SHOW without a container`);
4502
+ return -1;
4503
+ }
4504
+ $container.style.removeProperty("display");
4505
+ let $parent = $container.parentNode;
4506
+ if ($parent && $parent.lastChild !== $container) $parent.appendChild($container);
4395
4507
  return 0;
4396
4508
  }
4397
4509
  /************************************************************
@@ -4813,7 +4925,7 @@ function ac_register_window(gobj, event, kw, src) {
4813
4925
  if (prefix) label_items.push([
4814
4926
  "span",
4815
4927
  { class: "yui-dock-label-prefix" },
4816
- prefix
4928
+ text_node(prefix)
4817
4929
  ]);
4818
4930
  if (title_key) label_items.push([
4819
4931
  "span",
@@ -4826,7 +4938,7 @@ function ac_register_window(gobj, event, kw, src) {
4826
4938
  if (label_items.length === 0) label_items.push([
4827
4939
  "span",
4828
4940
  { class: "yui-dock-label-kind" },
4829
- title
4941
+ text_node(title)
4830
4942
  ]);
4831
4943
  let entry = {
4832
4944
  gobj: win,
@@ -4853,6 +4965,8 @@ function ac_register_window(gobj, event, kw, src) {
4853
4965
  {
4854
4966
  class: "yui-dock-close",
4855
4967
  type: "button",
4968
+ title: (0, i18next.t)("close"),
4969
+ "data-i18n-title": "close",
4856
4970
  "aria-label": (0, i18next.t)("close"),
4857
4971
  "data-i18n-aria-label": "close"
4858
4972
  },
@@ -5117,6 +5231,8 @@ function build_ui$17(gobj) {
5117
5231
  "button",
5118
5232
  {
5119
5233
  class: "yui-pager-back button is-white is-hidden",
5234
+ title: (0, i18next.t)("back"),
5235
+ "data-i18n-title": "back",
5120
5236
  "aria-label": (0, i18next.t)("back"),
5121
5237
  "data-i18n-aria-label": "back"
5122
5238
  },
@@ -5142,6 +5258,8 @@ function build_ui$17(gobj) {
5142
5258
  "button",
5143
5259
  {
5144
5260
  class: "yui-pager-discard button is-white is-hidden",
5261
+ title: (0, i18next.t)("discard"),
5262
+ "data-i18n-title": "discard",
5145
5263
  "aria-label": (0, i18next.t)("discard"),
5146
5264
  "data-i18n-aria-label": "discard"
5147
5265
  },
@@ -5222,13 +5340,12 @@ function render_header(gobj) {
5222
5340
  let $discard = $container.querySelector(".yui-pager-discard");
5223
5341
  $back.classList.toggle("is-hidden", !model.show_back);
5224
5342
  let $back_icon = $back.querySelector("i");
5225
- if (model.back_kind === "close") {
5226
- $back_icon.className = "yi-xmark";
5227
- $back.setAttribute("aria-label", "close");
5228
- } else {
5229
- $back_icon.className = "yi-arrow-left";
5230
- $back.setAttribute("aria-label", "back");
5231
- }
5343
+ let back_key = model.back_kind === "close" ? "close" : "back";
5344
+ $back_icon.className = back_key === "close" ? "yi-xmark" : "yi-arrow-left";
5345
+ $back.setAttribute("title", (0, i18next.t)(back_key));
5346
+ $back.setAttribute("data-i18n-title", back_key);
5347
+ $back.setAttribute("aria-label", (0, i18next.t)(back_key));
5348
+ $back.setAttribute("data-i18n-aria-label", back_key);
5232
5349
  $discard.classList.toggle("is-hidden", !model.show_discard);
5233
5350
  $title.setAttribute("data-i18n", model.title);
5234
5351
  $title.textContent = (0, i18next.t)(model.title);
@@ -5636,6 +5753,8 @@ function mt_destroy$18(gobj) {
5636
5753
  * Build UI
5637
5754
  ************************************************************/
5638
5755
  function build_ui$16(gobj) {
5756
+ let back_label = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "back_label");
5757
+ let next_label = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "next_label");
5639
5758
  let $container = (0, _yuneta_gobj_js.createElement2)([
5640
5759
  "div",
5641
5760
  {
@@ -5683,8 +5802,10 @@ function build_ui$16(gobj) {
5683
5802
  "button",
5684
5803
  {
5685
5804
  class: "yui-wizard-back button",
5686
- "aria-label": (0, i18next.t)("back"),
5687
- "data-i18n-aria-label": "back"
5805
+ title: (0, i18next.t)(back_label),
5806
+ "data-i18n-title": back_label,
5807
+ "aria-label": (0, i18next.t)(back_label),
5808
+ "data-i18n-aria-label": back_label
5688
5809
  },
5689
5810
  [[
5690
5811
  "span",
@@ -5694,9 +5815,9 @@ function build_ui$16(gobj) {
5694
5815
  "span",
5695
5816
  {
5696
5817
  class: "is-hidden-mobile",
5697
- i18n: "back"
5818
+ i18n: back_label
5698
5819
  },
5699
- "back"
5820
+ back_label
5700
5821
  ]],
5701
5822
  { click: function(evt) {
5702
5823
  evt.stopPropagation();
@@ -5706,16 +5827,18 @@ function build_ui$16(gobj) {
5706
5827
  "button",
5707
5828
  {
5708
5829
  class: "yui-wizard-primary button is-link",
5709
- "aria-label": (0, i18next.t)("next"),
5710
- "data-i18n-aria-label": "next"
5830
+ title: (0, i18next.t)(next_label),
5831
+ "data-i18n-title": next_label,
5832
+ "aria-label": (0, i18next.t)(next_label),
5833
+ "data-i18n-aria-label": next_label
5711
5834
  },
5712
5835
  [[
5713
5836
  "span",
5714
5837
  {
5715
5838
  class: "yui-wizard-primary-label",
5716
- i18n: "next"
5839
+ i18n: next_label
5717
5840
  },
5718
- "next"
5841
+ next_label
5719
5842
  ]],
5720
5843
  { click: function(evt) {
5721
5844
  evt.stopPropagation();
@@ -5774,14 +5897,19 @@ function render_chrome(gobj) {
5774
5897
  let $title = $container.querySelector(".yui-wizard-title");
5775
5898
  let $counter = $container.querySelector(".yui-wizard-counter");
5776
5899
  let $back = $container.querySelector(".yui-wizard-back");
5900
+ let $primary = $container.querySelector(".yui-wizard-primary");
5777
5901
  let $plabel = $container.querySelector(".yui-wizard-primary-label");
5778
- $title.setAttribute("i18n", model.title);
5779
- $title.textContent = model.title;
5902
+ $title.setAttribute("data-i18n", model.title);
5903
+ $title.textContent = (0, i18next.t)(model.title);
5780
5904
  if (model.count > 0) $counter.textContent = `${model.idx + 1} / ${model.count}`;
5781
5905
  else $counter.textContent = "";
5782
5906
  $back.classList.toggle("is-hidden", !model.show_back);
5783
- $plabel.setAttribute("i18n", model.primary_label);
5784
- $plabel.textContent = model.primary_label;
5907
+ $plabel.setAttribute("data-i18n", model.primary_label);
5908
+ $plabel.textContent = (0, i18next.t)(model.primary_label);
5909
+ $primary.setAttribute("title", (0, i18next.t)(model.primary_label));
5910
+ $primary.setAttribute("data-i18n-title", model.primary_label);
5911
+ $primary.setAttribute("aria-label", (0, i18next.t)(model.primary_label));
5912
+ $primary.setAttribute("data-i18n-aria-label", model.primary_label);
5785
5913
  for (let i = 0; i < priv.steps.length; i++) {
5786
5914
  let s = priv.steps[i];
5787
5915
  if (s.$el) s.$el.classList.toggle("is-hidden", i !== model.idx);
@@ -7995,6 +8123,112 @@ function datetime_local_to_epoch(value) {
7995
8123
  return Math.floor(date.getTime() / 1e3);
7996
8124
  }
7997
8125
  //#endregion
8126
+ //#region src/form_json_field.js
8127
+ /***********************************************************************
8128
+ * form_json_field.js
8129
+ *
8130
+ * Pure logic of a json field of C_YUI_FORM: what a jsoneditor
8131
+ * holds, read as the value its column stores.
8132
+ *
8133
+ * The editor answers its content in one of two shapes -- {json}
8134
+ * (tree mode) or {text} (text mode, whatever the reader typed).
8135
+ * A text that does not parse used to be caught and replaced by
8136
+ * `{}` or `[]`, and SAVED: a trailing comma wiped the column, with
8137
+ * no log and no message. A text that is not json, or json of the
8138
+ * wrong shape (a list in a dict column), is an error now, and the
8139
+ * form refuses to save while a field holds one.
8140
+ *
8141
+ * Copyright (c) 2026, ArtGins.
8142
+ * All Rights Reserved.
8143
+ ***********************************************************************/
8144
+ var SHAPE_OF_TYPE = {
8145
+ object: "dict",
8146
+ dict: "dict",
8147
+ template: "dict",
8148
+ array: "list",
8149
+ list: "list",
8150
+ table: "list",
8151
+ coordinates: "container"
8152
+ };
8153
+ /************************************************************
8154
+ * The shape `type` stores: "dict", "list", "container" or "any".
8155
+ ************************************************************/
8156
+ function json_field_shape(type) {
8157
+ return SHAPE_OF_TYPE[type] || "any";
8158
+ }
8159
+ /************************************************************
8160
+ * The empty value of a shape: what a blank editor stores.
8161
+ ************************************************************/
8162
+ function json_field_empty(shape) {
8163
+ if (shape === "list") return [];
8164
+ return {};
8165
+ }
8166
+ function value_fits(value, shape) {
8167
+ let is_list = Array.isArray(value);
8168
+ let is_dict = value !== null && typeof value === "object" && !is_list;
8169
+ switch (shape) {
8170
+ case "dict": return is_dict;
8171
+ case "list": return is_list;
8172
+ case "container": return is_dict || is_list;
8173
+ default: return true;
8174
+ }
8175
+ }
8176
+ /************************************************************
8177
+ * Parse what a json field holds.
8178
+ *
8179
+ * `value` is a json string (what the form reads out of an editor)
8180
+ * or an already parsed value; an editor's content goes through
8181
+ * json_editor_value() first.
8182
+ * Returns {value, error}: `error` is "" when the value is good, else
8183
+ * an i18n key; `value` is then the empty value of the shape and must
8184
+ * NOT be stored.
8185
+ *
8186
+ * A blank text is not an error: it is the empty value.
8187
+ ************************************************************/
8188
+ function parse_json_field(value, type) {
8189
+ let shape = json_field_shape(type);
8190
+ if (typeof value === "string") {
8191
+ if (value.trim() === "") return {
8192
+ value: json_field_empty(shape),
8193
+ error: ""
8194
+ };
8195
+ try {
8196
+ value = JSON.parse(value);
8197
+ } catch (e) {
8198
+ return {
8199
+ value: json_field_empty(shape),
8200
+ error: "invalid json"
8201
+ };
8202
+ }
8203
+ }
8204
+ if (value === void 0) return {
8205
+ value: json_field_empty(shape),
8206
+ error: ""
8207
+ };
8208
+ if (!value_fits(value, shape)) return {
8209
+ value: json_field_empty(shape),
8210
+ error: "invalid json"
8211
+ };
8212
+ return {
8213
+ value,
8214
+ error: ""
8215
+ };
8216
+ }
8217
+ /************************************************************
8218
+ * What a jsoneditor content ({text} or {json}) holds, as TEXT:
8219
+ * the text as typed, or the tree-mode json serialized -- which is
8220
+ * what get_form_values() reads out of the editor too. Handing the
8221
+ * tree-mode value back as is made parse_json_field() parse a
8222
+ * string ROOT a second time: "123" was checked as the number 123,
8223
+ * and "abc" as a text that is no json.
8224
+ ************************************************************/
8225
+ function json_editor_value(content) {
8226
+ if (!content) return;
8227
+ if (content.text !== void 0) return content.text;
8228
+ if (content.json === void 0) return;
8229
+ return JSON.stringify(content.json);
8230
+ }
8231
+ //#endregion
7998
8232
  //#region src/c_yui_form.js
7999
8233
  /***********************************************************************
8000
8234
  * c_yui_form.js
@@ -8041,7 +8275,11 @@ var attrs_table$17 = [
8041
8275
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_BOOLEAN, "changes", 0, false, "Indicates if changes have been made"),
8042
8276
  (0, _yuneta_gobj_js.SDATA_END)()
8043
8277
  ];
8044
- var PRIVATE_DATA$17 = {};
8278
+ var PRIVATE_DATA$17 = {
8279
+ rearm_timer: null,
8280
+ tables: null,
8281
+ table_seq: 0
8282
+ };
8045
8283
  var __gclass__$17 = null;
8046
8284
  /***************************
8047
8285
  * Framework Methods
@@ -8055,6 +8293,7 @@ function mt_create$17(gobj) {
8055
8293
  (0, _yuneta_gobj_js.gobj_subscribe_event)(gobj, null, {}, subscriber);
8056
8294
  let name = (0, _yuneta_gobj_js.clean_name)((0, _yuneta_gobj_js.gobj_name)(gobj));
8057
8295
  (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "form_id", "form" + name);
8296
+ gobj.priv.tables = /* @__PURE__ */ new Map();
8058
8297
  build_ui$15(gobj);
8059
8298
  }
8060
8299
  /************************************************************
@@ -8108,26 +8347,30 @@ function set_changed_stated(gobj, changed) {
8108
8347
  enable($button_save, true, "MediumSeaGreen");
8109
8348
  enable($button_undo, true, "Magenta");
8110
8349
  $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
8111
- if (isEventSet($table.tabulator, "dataChanged")) $table.tabulator.off("dataChanged");
8350
+ if ($table.tabulator && isEventSet($table.tabulator, "dataChanged")) $table.tabulator.off("dataChanged");
8112
8351
  $table.querySelectorAll(".yui-tabulator-table-nested").forEach(($table_nested) => {
8113
- if (isEventSet($table_nested.tabulator, "dataChanged")) $table_nested.tabulator.off("dataChanged");
8352
+ if ($table_nested.tabulator && isEventSet($table_nested.tabulator, "dataChanged")) $table_nested.tabulator.off("dataChanged");
8114
8353
  });
8115
8354
  });
8116
8355
  } else {
8117
8356
  (0, _yuneta_gobj_js.gobj_write_bool_attr)(gobj, "changes", false);
8118
8357
  enable($button_save, false, OFF_COLOR);
8119
8358
  enable($button_undo, false, OFF_COLOR);
8120
- setTimeout(function() {
8121
- $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
8122
- if (isEventSet($table.tabulator, "dataChanged")) $table.tabulator.off("dataChanged");
8123
- $table.tabulator.on("dataChanged", function(data) {
8359
+ if (gobj.priv.rearm_timer) clearTimeout(gobj.priv.rearm_timer);
8360
+ gobj.priv.rearm_timer = setTimeout(function() {
8361
+ gobj.priv.rearm_timer = null;
8362
+ if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
8363
+ const rearm = (tabulator) => {
8364
+ if (!tabulator) return;
8365
+ if (isEventSet(tabulator, "dataChanged")) tabulator.off("dataChanged");
8366
+ tabulator.on("dataChanged", function(data) {
8124
8367
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_RECORD_CHANGED", {}, gobj);
8125
8368
  });
8369
+ };
8370
+ $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
8371
+ rearm($table.tabulator);
8126
8372
  $table.querySelectorAll(".yui-tabulator-table-nested").forEach(($table_nested) => {
8127
- if (isEventSet($table_nested.tabulator, "dataChanged")) $table_nested.tabulator.off("dataChanged");
8128
- $table_nested.tabulator.on("dataChanged", function(data) {
8129
- (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_RECORD_CHANGED", {}, gobj);
8130
- });
8373
+ rearm($table_nested.tabulator);
8131
8374
  });
8132
8375
  });
8133
8376
  }, 200);
@@ -8357,12 +8600,110 @@ function build_ui$15(gobj) {
8357
8600
  * Destroy UI
8358
8601
  ************************************************************/
8359
8602
  function destroy_ui$10(gobj) {
8603
+ if (gobj.priv && gobj.priv.rearm_timer) {
8604
+ clearTimeout(gobj.priv.rearm_timer);
8605
+ gobj.priv.rearm_timer = null;
8606
+ }
8360
8607
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
8361
8608
  if ($container) {
8609
+ destroy_widgets(gobj, $container);
8362
8610
  if ($container.parentNode) $container.parentNode.removeChild($container);
8363
8611
  (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "$container", null);
8364
8612
  }
8365
8613
  }
8614
+ /************************************************************
8615
+ * The icon a table cell draws as its control (delete the row,
8616
+ * add a nested row): an element, so it carries its name. Drawn
8617
+ * by Tabulator on every render, so t() at render time is
8618
+ * current.
8619
+ ************************************************************/
8620
+ function cell_icon(icon_class, key) {
8621
+ let $i = document.createElement("i");
8622
+ $i.className = icon_class;
8623
+ $i.setAttribute("role", "button");
8624
+ $i.setAttribute("tabindex", "0");
8625
+ $i.setAttribute("title", (0, i18next.t)(key));
8626
+ $i.setAttribute("data-i18n-title", key);
8627
+ $i.setAttribute("aria-label", (0, i18next.t)(key));
8628
+ $i.setAttribute("data-i18n-aria-label", key);
8629
+ $i.addEventListener("keydown", function(evt) {
8630
+ if (evt.key === "Enter" || evt.key === " ") {
8631
+ evt.preventDefault();
8632
+ $i.click();
8633
+ }
8634
+ });
8635
+ return $i;
8636
+ }
8637
+ /************************************************************
8638
+ * The identity of a table element, for the kw of
8639
+ * EV_ADD_TABLE_ROW: a kw is plain json, and an element (with its
8640
+ * `.tabulator`, circular) broke the `machine` trace that dumps it.
8641
+ * Given on first use and kept on the element; the registry holds
8642
+ * it weakly, so a nested table re-built by its row formatter is
8643
+ * not kept alive by it.
8644
+ ************************************************************/
8645
+ function table_identity(gobj, $table) {
8646
+ if (!$table.yui_table_id) {
8647
+ let priv = gobj.priv;
8648
+ priv.table_seq += 1;
8649
+ $table.yui_table_id = `t${priv.table_seq}`;
8650
+ priv.tables.set($table.yui_table_id, new WeakRef($table));
8651
+ }
8652
+ return $table.yui_table_id;
8653
+ }
8654
+ /************************************************************
8655
+ * The element of a table identity, or null when it is gone.
8656
+ ************************************************************/
8657
+ function find_table(gobj, table_id) {
8658
+ let priv = gobj.priv;
8659
+ let ref = priv.tables ? priv.tables.get(table_id) : null;
8660
+ let $table = ref ? ref.deref() : null;
8661
+ if (!$table) {
8662
+ if (priv.tables) priv.tables.delete(table_id);
8663
+ return null;
8664
+ }
8665
+ return $table;
8666
+ }
8667
+ /************************************************************
8668
+ * Destroy the third-party widgets the form built. Removing
8669
+ * their DOM is not enough: Tom Select keeps listeners on
8670
+ * `document` and `window`, the jsoneditor is a live Svelte app
8671
+ * and a Tabulator keeps its observers -- each one a closure over
8672
+ * this form, alive for the life of the page. Nested tables go
8673
+ * first: their parent's destroy drops the rows they hang from.
8674
+ ************************************************************/
8675
+ function destroy_widgets(gobj, $container) {
8676
+ let destroy = (what, widget) => {
8677
+ try {
8678
+ let r = widget.destroy();
8679
+ if (r && typeof r.then === "function") r.catch((e) => {
8680
+ (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot destroy ${what}: ${e}`);
8681
+ });
8682
+ } catch (e) {
8683
+ (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot destroy ${what}: ${e}`);
8684
+ }
8685
+ };
8686
+ $container.querySelectorAll(".yui-tabulator-table-nested").forEach(($el) => {
8687
+ if ($el.tabulator) {
8688
+ destroy("nested table", $el.tabulator);
8689
+ $el.tabulator = null;
8690
+ }
8691
+ });
8692
+ $container.querySelectorAll(".yui-form-data-input").forEach(($el) => {
8693
+ if ($el.tom_select) {
8694
+ destroy("select", $el.tom_select);
8695
+ $el.tom_select = null;
8696
+ }
8697
+ if ($el.jsoneditor) {
8698
+ destroy("json editor", $el.jsoneditor);
8699
+ $el.jsoneditor = null;
8700
+ }
8701
+ if ($el.tabulator) {
8702
+ destroy("table", $el.tabulator);
8703
+ $el.tabulator = null;
8704
+ }
8705
+ });
8706
+ }
8366
8707
  /******************************************************************
8367
8708
  * Build form with bulma and createElement2
8368
8709
  ******************************************************************/
@@ -8395,6 +8736,15 @@ function name_form_control($field, conf) {
8395
8736
  $ts.setAttribute("aria-label", (0, i18next.t)(key));
8396
8737
  $ts.setAttribute("data-i18n-aria-label", key);
8397
8738
  }
8739
+ let $clear = $field.querySelector(".ts-wrapper .clear-button");
8740
+ if ($clear) {
8741
+ const CLEAR_KEY = "remove all selected options";
8742
+ $clear.setAttribute("role", "button");
8743
+ $clear.setAttribute("title", (0, i18next.t)(CLEAR_KEY));
8744
+ $clear.setAttribute("data-i18n-title", CLEAR_KEY);
8745
+ $clear.setAttribute("aria-label", (0, i18next.t)(CLEAR_KEY));
8746
+ $clear.setAttribute("data-i18n-aria-label", CLEAR_KEY);
8747
+ }
8398
8748
  }
8399
8749
  function build_form(gobj) {
8400
8750
  let form_id = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "form_id");
@@ -8745,12 +9095,7 @@ function apply_form_mode(gobj, $form) {
8745
9095
  ******************************************************************/
8746
9096
  function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, name, label, label_i18n, placeholder, options, extras, readonly, required, hidden, default_value }) {
8747
9097
  let $element;
8748
- let kw_add_table_row = {
8749
- $row: null,
8750
- $table: null,
8751
- record: {},
8752
- loading: false
8753
- };
9098
+ let $add_table = null;
8754
9099
  switch (tag) {
8755
9100
  case "input":
8756
9101
  switch (inputType) {
@@ -8768,7 +9113,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8768
9113
  i18n: label_i18n || label,
8769
9114
  for: name
8770
9115
  },
8771
- label
9116
+ text_node(label)
8772
9117
  ]]
8773
9118
  ], [
8774
9119
  "div",
@@ -8801,7 +9146,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8801
9146
  i18n: label_i18n || label,
8802
9147
  for: name
8803
9148
  },
8804
- label
9149
+ text_node(label)
8805
9150
  ]]
8806
9151
  ], [
8807
9152
  "div",
@@ -8842,7 +9187,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8842
9187
  i18n: label_i18n || label,
8843
9188
  for: name
8844
9189
  },
8845
- label
9190
+ text_node(label)
8846
9191
  ]]
8847
9192
  ], [
8848
9193
  "div",
@@ -8873,7 +9218,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8873
9218
  i18n: label_i18n || label,
8874
9219
  for: name
8875
9220
  },
8876
- label
9221
+ text_node(label)
8877
9222
  ]]
8878
9223
  ], [
8879
9224
  "div",
@@ -8903,7 +9248,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8903
9248
  class: "label",
8904
9249
  i18n: label_i18n || label
8905
9250
  },
8906
- label
9251
+ text_node(label)
8907
9252
  ]]
8908
9253
  ], [
8909
9254
  "div",
@@ -8916,7 +9261,13 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8916
9261
  { class: "" },
8917
9262
  [[
8918
9263
  "button",
8919
- { class: "button p-1" },
9264
+ {
9265
+ class: "button p-1",
9266
+ title: (0, i18next.t)("add"),
9267
+ "data-i18n-title": "add",
9268
+ "aria-label": (0, i18next.t)("add"),
9269
+ "data-i18n-aria-label": "add"
9270
+ },
8920
9271
  [[
8921
9272
  "span",
8922
9273
  { class: "icon m-0" },
@@ -8932,7 +9283,15 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8932
9283
  { click: function(evt) {
8933
9284
  evt.stopPropagation();
8934
9285
  evt.preventDefault();
8935
- (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_ADD_TABLE_ROW", kw_add_table_row, gobj);
9286
+ if (!$add_table) {
9287
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: "add" of a field without a table`);
9288
+ return;
9289
+ }
9290
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_ADD_TABLE_ROW", {
9291
+ table_id: table_identity(gobj, $add_table),
9292
+ record: {},
9293
+ loading: false
9294
+ }, gobj);
8936
9295
  } }
8937
9296
  ]]
8938
9297
  ]]
@@ -8988,7 +9347,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8988
9347
  i18n: label_i18n || label,
8989
9348
  for: name
8990
9349
  },
8991
- label
9350
+ text_node(label)
8992
9351
  ]]
8993
9352
  ], [
8994
9353
  "div",
@@ -9074,7 +9433,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9074
9433
  value: option,
9075
9434
  i18n: option
9076
9435
  },
9077
- option
9436
+ text_node(option)
9078
9437
  ]),
9079
9438
  { "change": function(evt) {
9080
9439
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_RECORD_CHANGED", {}, gobj);
@@ -9103,14 +9462,14 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9103
9462
  opts.map((option) => is_icon ? [
9104
9463
  "option",
9105
9464
  { value: option },
9106
- option
9465
+ text_node(option)
9107
9466
  ] : [
9108
9467
  "option",
9109
9468
  {
9110
9469
  value: option,
9111
9470
  i18n: option
9112
9471
  },
9113
- option
9472
+ text_node(option)
9114
9473
  ])
9115
9474
  ];
9116
9475
  $extend = (0, _yuneta_gobj_js.createElement2)(extend);
@@ -9153,13 +9512,19 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9153
9512
  break;
9154
9513
  }
9155
9514
  case "radio": {
9156
- let elm = `
9157
- <label class="radio">
9158
- <input type="radio" name="${name}">
9159
- ${(0, i18next.t)(options)}
9160
- </label>
9161
- `;
9162
- $extend = (0, _yuneta_gobj_js.createOneHtml)(elm);
9515
+ let label_key = String(options === void 0 || options === null ? "" : options);
9516
+ $extend = (0, _yuneta_gobj_js.createElement2)([
9517
+ "label",
9518
+ { class: "radio" },
9519
+ [["input", {
9520
+ type: "radio",
9521
+ name
9522
+ }], [
9523
+ "span",
9524
+ { i18n: label_key },
9525
+ text_node(label_key)
9526
+ ]]
9527
+ ]);
9163
9528
  $control.appendChild($extend);
9164
9529
  break;
9165
9530
  }
@@ -9179,6 +9544,10 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9179
9544
  props: {
9180
9545
  readOnly: !!readonly,
9181
9546
  onChange: function() {
9547
+ if ($extend.yui_json_error) {
9548
+ check_json_editor($extend);
9549
+ mark_field_validity($extend);
9550
+ }
9182
9551
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_RECORD_CHANGED", {}, gobj);
9183
9552
  },
9184
9553
  timestampTag: function({ field, value, path }) {
@@ -9205,7 +9574,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9205
9574
  }]);
9206
9575
  $control.appendChild($extend);
9207
9576
  $extend.tabulator = create_tabulator$1(gobj, $extend, name, options);
9208
- kw_add_table_row["$table"] = $extend;
9577
+ $add_table = $extend;
9209
9578
  break;
9210
9579
  case "coordinates": {
9211
9580
  let attrs = {
@@ -9502,7 +9871,7 @@ function create_tabulator$1(gobj, $extend, name, template) {
9502
9871
  };
9503
9872
  if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "with_delete_row_btn")) columns.push({
9504
9873
  formatter: function(cell, formatterParams) {
9505
- return "<i style=\"\" class=\"yi-trash has-text-danger\"></i>";
9874
+ return cell_icon("yi-trash has-text-danger", "delete");
9506
9875
  },
9507
9876
  width: 40,
9508
9877
  hozAlign: "center",
@@ -9583,16 +9952,18 @@ function template2columns(gobj, columns, template, sub_elements) {
9583
9952
  });
9584
9953
  Object.assign(column, {
9585
9954
  formatter: function(cell, formatterParams) {
9586
- return "<i style=\"\" class=\"yi-plus has-text-link\"></i>";
9955
+ return cell_icon("yi-plus has-text-link", "add");
9587
9956
  },
9588
9957
  hozAlign: "center",
9589
9958
  cellClick: function(evt, cell) {
9590
9959
  evt.stopPropagation();
9591
- let $row = cell.getRow().getElement();
9592
- let $extend = $row.querySelector(`[name="${field_desc.name}"]`);
9960
+ let $extend = cell.getRow().getElement().querySelector(`[name="${field_desc.name}"]`);
9961
+ if (!$extend) {
9962
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: nested table '${field_desc.name}' not found in its row`);
9963
+ return;
9964
+ }
9593
9965
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_ADD_TABLE_ROW", {
9594
- $row,
9595
- $table: $extend,
9966
+ table_id: table_identity(gobj, $extend),
9596
9967
  record: {},
9597
9968
  loading: false
9598
9969
  }, gobj);
@@ -9725,11 +10096,22 @@ function template2columns(gobj, columns, template, sub_elements) {
9725
10096
  * out-of-range number is more precise than anything generic here.
9726
10097
  ************************************************************/
9727
10098
  function field_validation_message($input) {
9728
- let v = $input.validity;
9729
- if (v && v.valueMissing) return (0, i18next.t)("this field is required");
10099
+ let key = field_validation_key($input);
10100
+ if (key) return (0, i18next.t)(key);
9730
10101
  return $input.validationMessage;
9731
10102
  }
9732
10103
  /************************************************************
10104
+ * The i18n key of the message, when the message is ours ("" when
10105
+ * it is the browser's): written as the help line's data-i18n, so
10106
+ * a language change re-translates the line on screen.
10107
+ ************************************************************/
10108
+ function field_validation_key($input) {
10109
+ if ($input.yui_json_error) return $input.yui_json_error;
10110
+ let v = $input.validity;
10111
+ if (v && v.valueMissing) return "this field is required";
10112
+ return "";
10113
+ }
10114
+ /************************************************************
9733
10115
  * Mark a field as wrong, or clear the mark. One place: the same
9734
10116
  * three lines lived in the `invalid` and `blur` handlers of every
9735
10117
  * field kind.
@@ -9737,16 +10119,20 @@ function field_validation_message($input) {
9737
10119
  function mark_field_validity($input) {
9738
10120
  let $h = $input.parentNode ? $input.parentNode.querySelector(".help") : null;
9739
10121
  let v = $input.validity;
9740
- if (!v || v.valid) {
10122
+ if ((!v || v.valid) && !$input.yui_json_error) {
9741
10123
  $input.classList.remove("is-danger");
9742
10124
  if ($h) {
9743
10125
  $h.textContent = "";
10126
+ $h.removeAttribute("data-i18n");
9744
10127
  $h.style.display = "none";
9745
10128
  }
9746
10129
  return true;
9747
10130
  }
9748
10131
  $input.classList.add("is-danger");
9749
10132
  if ($h) {
10133
+ let key = field_validation_key($input);
10134
+ if (key) $h.setAttribute("data-i18n", key);
10135
+ else $h.removeAttribute("data-i18n");
9750
10136
  $h.textContent = field_validation_message($input);
9751
10137
  $h.style.display = "block";
9752
10138
  }
@@ -9758,6 +10144,12 @@ function mark_field_validity($input) {
9758
10144
  function validate_form(gobj, $form) {
9759
10145
  let validated = true;
9760
10146
  if (!$form.checkValidity()) validated = false;
10147
+ $form.querySelectorAll(".jsoneditor.yui-form-data-input").forEach(($editor) => {
10148
+ if (!check_json_editor($editor)) {
10149
+ validated = false;
10150
+ mark_field_validity($editor);
10151
+ }
10152
+ });
9761
10153
  $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
9762
10154
  if (!$table.tabulator.validate()) validated = false;
9763
10155
  $table.querySelectorAll(".yui-tabulator-table-nested").forEach(($table_nested) => {
@@ -9767,6 +10159,22 @@ function validate_form(gobj, $form) {
9767
10159
  return validated;
9768
10160
  }
9769
10161
  /************************************************************
10162
+ * Does the jsoneditor `$editor` hold json its column can store?
10163
+ * Leaves the answer on the element (`yui_json_error`, an i18n key
10164
+ * or ""), where mark_field_validity() reads it.
10165
+ ************************************************************/
10166
+ function check_json_editor($editor) {
10167
+ let jsoneditor = $editor.jsoneditor;
10168
+ let field_desc = $editor.field_desc;
10169
+ if (!jsoneditor || !field_desc || $editor.hasAttribute("readonly")) {
10170
+ $editor.yui_json_error = "";
10171
+ return true;
10172
+ }
10173
+ let r = parse_json_field(json_editor_value(jsoneditor.get()), field_desc.type);
10174
+ $editor.yui_json_error = r.error;
10175
+ return !r.error;
10176
+ }
10177
+ /************************************************************
9770
10178
  * Function to get input value based on its type
9771
10179
  ************************************************************/
9772
10180
  function getInputValue($input) {
@@ -10018,15 +10426,13 @@ function load_tabulator_data(gobj, $table, value) {
10018
10426
  }
10019
10427
  let tabulator = $table.tabulator;
10020
10428
  if (tabulator.initialized) for (let row of value) (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_ADD_TABLE_ROW", {
10021
- $row: null,
10022
- $table,
10429
+ table_id: table_identity(gobj, $table),
10023
10430
  record: row,
10024
10431
  loading: true
10025
10432
  }, gobj);
10026
10433
  else tabulator.on("tableBuilt", function() {
10027
10434
  for (let row of value) (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_ADD_TABLE_ROW", {
10028
- $row: null,
10029
- $table,
10435
+ table_id: table_identity(gobj, $table),
10030
10436
  record: row,
10031
10437
  loading: true
10032
10438
  }, gobj);
@@ -10124,23 +10530,28 @@ function treedb_value_2_form_value(gobj, field_desc, value) {
10124
10530
  return value;
10125
10531
  }
10126
10532
  /************************************************************
10533
+ * A json field's value, parsed. validate_form() refuses a field
10534
+ * that does not parse, so reaching the error here is a path that
10535
+ * skipped it: logged, and the value is handed on AS IT IS. An
10536
+ * empty `{}` / `[]` in its place is a value nobody wrote, and
10537
+ * saved it wipes the column.
10538
+ ************************************************************/
10539
+ function parse_json_value(gobj, field_desc, value) {
10540
+ let r = parse_json_field(value, field_desc.type);
10541
+ if (r.error) {
10542
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: field '${field_desc.name}' (${field_desc.type}) holds no valid json, handed on as it is`);
10543
+ return value;
10544
+ }
10545
+ return r.value;
10546
+ }
10547
+ /************************************************************
10127
10548
  * Convert from frontend to backend
10128
10549
  * operation: "create" "update"
10129
10550
  ************************************************************/
10130
10551
  function form_value_2_treedb_value(gobj, field_desc, value) {
10131
10552
  let type = field_desc.type;
10132
10553
  let real_type = field_desc.real_type;
10133
- if ((0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "render_mode") === "edit" && (type === "template" || type === "table" || type === "coordinates")) {
10134
- if ((0, _yuneta_gobj_js.is_string)(value)) try {
10135
- value = JSON.parse(value);
10136
- } catch (e) {
10137
- value = type === "table" ? [] : {};
10138
- }
10139
- if (type === "table") {
10140
- if (!(0, _yuneta_gobj_js.is_array)(value)) value = [];
10141
- } else if (!(0, _yuneta_gobj_js.is_object)(value) && !(0, _yuneta_gobj_js.is_array)(value)) value = {};
10142
- return value;
10143
- }
10554
+ if ((0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "render_mode") === "edit" && (type === "template" || type === "table" || type === "coordinates")) return parse_json_value(gobj, field_desc, value);
10144
10555
  switch (type) {
10145
10556
  case "file": break;
10146
10557
  case "fkey":
@@ -10177,13 +10588,7 @@ function form_value_2_treedb_value(gobj, field_desc, value) {
10177
10588
  case "tel":
10178
10589
  case "svg": break;
10179
10590
  case "template":
10180
- if ((0, _yuneta_gobj_js.is_string)(value)) try {
10181
- value = JSON.parse(value);
10182
- } catch (e) {
10183
- value = {};
10184
- }
10185
- else if ((0, _yuneta_gobj_js.is_object)(value)) {}
10186
- if (!(0, _yuneta_gobj_js.is_object)(value)) value = {};
10591
+ value = parse_json_value(gobj, field_desc, value);
10187
10592
  break;
10188
10593
  case "table":
10189
10594
  case "id":
@@ -10197,16 +10602,12 @@ function form_value_2_treedb_value(gobj, field_desc, value) {
10197
10602
  value = parseInt(value) || 0;
10198
10603
  break;
10199
10604
  case "object":
10200
- case "dict": break;
10605
+ case "dict":
10606
+ value = parse_json_value(gobj, field_desc, value);
10607
+ break;
10201
10608
  case "array":
10202
10609
  case "list":
10203
- if ((0, _yuneta_gobj_js.is_string)(value)) try {
10204
- value = JSON.parse(value);
10205
- } catch (e) {
10206
- value = [];
10207
- }
10208
- else if ((0, _yuneta_gobj_js.is_array)(value)) {}
10209
- if (!(0, _yuneta_gobj_js.is_array)(value)) value = [];
10610
+ value = parse_json_value(gobj, field_desc, value);
10210
10611
  break;
10211
10612
  case "real":
10212
10613
  value = parseFloat(value) || 0;
@@ -10215,12 +10616,7 @@ function form_value_2_treedb_value(gobj, field_desc, value) {
10215
10616
  value = (0, _yuneta_gobj_js.parseBoolean)(value);
10216
10617
  break;
10217
10618
  case "blob":
10218
- if ((0, _yuneta_gobj_js.is_string)(value)) try {
10219
- value = JSON.parse(value);
10220
- } catch (e) {
10221
- value = {};
10222
- }
10223
- else if ((0, _yuneta_gobj_js.is_object)(value)) {} else if ((0, _yuneta_gobj_js.is_array)(value)) {} else value = {};
10619
+ value = parse_json_value(gobj, field_desc, value);
10224
10620
  break;
10225
10621
  case "number": break;
10226
10622
  case "coordinates":
@@ -10344,9 +10740,13 @@ function ac_set_file_preview(gobj, event, kw, src) {
10344
10740
  * or from load_tabulator_data() to load data from backend
10345
10741
  ************************************************************/
10346
10742
  function ac_add_table_row(gobj, event, kw, src) {
10347
- let $row = kw["$row"];
10348
- let $table = kw.$table;
10349
- let tabulator = $table.tabulator;
10743
+ let table_id = kw.table_id;
10744
+ let $table = find_table(gobj, table_id);
10745
+ let tabulator = $table ? $table.tabulator : null;
10746
+ if (!tabulator) {
10747
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: EV_ADD_TABLE_ROW to a table that is gone: '${table_id}'`);
10748
+ return -1;
10749
+ }
10350
10750
  let record = kw.record;
10351
10751
  let loading = kw.loading;
10352
10752
  tabulator.addRow(record).then(function(row) {
@@ -10360,12 +10760,13 @@ function ac_add_table_row(gobj, event, kw, src) {
10360
10760
  }
10361
10761
  });
10362
10762
  }
10363
- }).catch(function(error) {});
10763
+ }).catch(function(error) {
10764
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot add a table row: ${error}`);
10765
+ });
10364
10766
  setTimeout(function() {
10365
- if ($row) {
10366
- let $tabulator = $row.closest(".yui-tabulator-table");
10367
- if ($tabulator && $tabulator.tabulator) $tabulator.tabulator.redraw();
10368
- } else tabulator.redraw();
10767
+ if ((0, _yuneta_gobj_js.gobj_is_destroying)(gobj)) return;
10768
+ let $outer = $table.closest(".yui-tabulator-table");
10769
+ if ($outer && $outer.tabulator) $outer.tabulator.redraw();
10369
10770
  }, 30);
10370
10771
  return 0;
10371
10772
  }
@@ -10833,7 +11234,7 @@ function yui_maplibre_relocalize(map, t) {
10833
11234
  *
10834
11235
  * Map Manager
10835
11236
  *
10836
- * Copyright (c) 2025, ArtGins.
11237
+ * Copyright (c) 2025-2026, ArtGins.
10837
11238
  * All Rights Reserved.
10838
11239
  ***********************************************************************/
10839
11240
  /***************************************************************
@@ -10979,9 +11380,22 @@ function mt_start$16(gobj) {
10979
11380
  function mt_stop$16(gobj) {
10980
11381
  let shell = yui_shell_of(gobj);
10981
11382
  if (shell) (0, _yuneta_gobj_js.gobj_unsubscribe_event)(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
11383
+ retire_marker_windows(gobj);
11384
+ (0, _yuneta_gobj_js.gobj_stop_children)(gobj);
10982
11385
  return 0;
10983
11386
  }
10984
11387
  /***************************************************************
11388
+ * Destroy the windows the markers opened.
11389
+ ***************************************************************/
11390
+ function retire_marker_windows(gobj) {
11391
+ let windows = (0, _yuneta_gobj_js.gobj_match_children)(gobj, { __gclass_name__: "C_YUI_WINDOW" }) || [];
11392
+ for (let win of windows) {
11393
+ if ((0, _yuneta_gobj_js.gobj_is_running)(win)) (0, _yuneta_gobj_js.gobj_stop)(win);
11394
+ (0, _yuneta_gobj_js.gobj_stop_children)(win);
11395
+ (0, _yuneta_gobj_js.gobj_destroy)(win);
11396
+ }
11397
+ }
11398
+ /***************************************************************
10985
11399
  * Framework Method: Destroy
10986
11400
  ***************************************************************/
10987
11401
  function mt_destroy$16(gobj) {
@@ -11268,52 +11682,24 @@ function find_device(gobj, id) {
11268
11682
  return null;
11269
11683
  }
11270
11684
  /************************************************************
11271
- * Event handler for click
11685
+ * Event handler for click: maplibre's callback only turns the
11686
+ * click into an event; the work is ac_marker_clicked().
11687
+ * Plain json: the marker's identity and where it is.
11272
11688
  ************************************************************/
11273
11689
  function onClick(gobj, e) {
11274
- const map = gobj.priv.xmap;
11275
- const coordinates = e.features[0].geometry.coordinates.slice();
11276
- const properties = e.features[0].properties;
11277
- const gobj_service = properties.gobj_service_name ? (0, _yuneta_gobj_js.gobj_find_service)(properties.gobj_service_name, false) : null;
11278
- if (gobj_service) {
11279
- let window_service_name = `window-map-${(0, _yuneta_gobj_js.clean_name)((0, _yuneta_gobj_js.gobj_name)(gobj_service))}`;
11280
- let popupContent = (0, _yuneta_gobj_js.createElement2)([
11281
- "div",
11282
- { class: "xmap columns m-0 p-0 is-flex-wrap-wrap" },
11283
- (0, _yuneta_gobj_js.gobj_read_attr)(gobj_service, "$container")
11284
- ]);
11285
- let gobj_window = (0, _yuneta_gobj_js.gobj_create_service)(window_service_name, "C_YUI_WINDOW", {
11286
- $parent: document.getElementById("top-layer"),
11287
- width: 700,
11288
- height: 500,
11289
- auto_save_size_and_position: false,
11290
- center: true,
11291
- showMax: false,
11292
- content_size: true,
11293
- title_prefix: (0, _yuneta_gobj_js.gobj_name)(gobj_service),
11294
- title: "",
11295
- icon: "yi-location-dot",
11296
- logical_class: "MAP_MARKER_WINDOW",
11297
- body: popupContent
11298
- }, gobj);
11299
- if (!gobj_window) {
11300
- (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_name)(gobj)}: cannot create the marker window`);
11301
- return;
11302
- }
11303
- (0, _yuneta_gobj_js.gobj_start)(gobj_window);
11304
- } else {
11305
- const popup = new maplibre_gl.Popup({
11306
- closeButton: true,
11307
- closeOnClick: true,
11308
- closeOnMove: true,
11309
- anchor: "center",
11310
- maxWidth: "none"
11311
- });
11312
- const popupContent = `
11313
- <b>${properties.name}</b><br>Id: ${properties.id}
11314
- `;
11315
- popup.setLngLat(coordinates).setHTML(popupContent).addTo(map);
11690
+ let feature = e && e.features && e.features[0];
11691
+ if (!feature) {
11692
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_name)(gobj)}: marker click with no feature`);
11693
+ return;
11316
11694
  }
11695
+ let properties = feature.properties || {};
11696
+ let coordinates = feature.geometry.coordinates.slice();
11697
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_MARKER_CLICKED", {
11698
+ gobj_service_name: properties.gobj_service_name || "",
11699
+ name: properties.name !== void 0 ? String(properties.name) : "",
11700
+ id: properties.id !== void 0 ? String(properties.id) : "",
11701
+ coordinates
11702
+ }, gobj);
11317
11703
  }
11318
11704
  /************************************************************
11319
11705
  * Event handlers for dragging
@@ -11422,6 +11808,68 @@ function ac_refresh$7(gobj, event, kw, src) {
11422
11808
  return 0;
11423
11809
  }
11424
11810
  /************************************************************
11811
+ * EV_MARKER_CLICKED {gobj_service_name, name, id, coordinates}
11812
+ *
11813
+ * A marker backed by a gobj service opens that service's view in
11814
+ * a window -- ONE per marker: a second click is told to the open
11815
+ * one (EV_SHOW). (It created a second window under the same service
11816
+ * name, moved the one $container into it and left the first one
11817
+ * empty; closing the first then unregistered the second's name.)
11818
+ * A marker without a service gets a popup with its name and id.
11819
+ ************************************************************/
11820
+ function ac_marker_clicked(gobj, event, kw, src) {
11821
+ const map = gobj.priv.xmap;
11822
+ const gobj_service = kw.gobj_service_name ? (0, _yuneta_gobj_js.gobj_find_service)(kw.gobj_service_name, false) : null;
11823
+ if (gobj_service) {
11824
+ let window_service_name = `window-map-${(0, _yuneta_gobj_js.clean_name)((0, _yuneta_gobj_js.gobj_name)(gobj_service))}`;
11825
+ let gobj_window = (0, _yuneta_gobj_js.gobj_find_service)(window_service_name, false);
11826
+ if (gobj_window) {
11827
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj_window, "EV_SHOW", {}, gobj);
11828
+ return 0;
11829
+ }
11830
+ let popupContent = (0, _yuneta_gobj_js.createElement2)([
11831
+ "div",
11832
+ { class: "xmap columns m-0 p-0 is-flex-wrap-wrap" },
11833
+ (0, _yuneta_gobj_js.gobj_read_attr)(gobj_service, "$container")
11834
+ ]);
11835
+ gobj_window = (0, _yuneta_gobj_js.gobj_create_service)(window_service_name, "C_YUI_WINDOW", {
11836
+ $parent: document.getElementById("top-layer"),
11837
+ width: 700,
11838
+ height: 500,
11839
+ auto_save_size_and_position: false,
11840
+ center: true,
11841
+ showMax: false,
11842
+ content_size: true,
11843
+ title_prefix: (0, _yuneta_gobj_js.gobj_name)(gobj_service),
11844
+ title: "",
11845
+ icon: "yi-location-dot",
11846
+ logical_class: "MAP_MARKER_WINDOW",
11847
+ body: popupContent
11848
+ }, gobj);
11849
+ if (!gobj_window) {
11850
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_name)(gobj)}: cannot create the marker window`);
11851
+ return -1;
11852
+ }
11853
+ (0, _yuneta_gobj_js.gobj_start)(gobj_window);
11854
+ return 0;
11855
+ }
11856
+ const popup = new maplibre_gl.Popup({
11857
+ closeButton: true,
11858
+ closeOnClick: true,
11859
+ closeOnMove: true,
11860
+ anchor: "center",
11861
+ maxWidth: "none"
11862
+ });
11863
+ let $content = document.createElement("div");
11864
+ let $name = document.createElement("b");
11865
+ $name.textContent = kw.name;
11866
+ $content.appendChild($name);
11867
+ $content.appendChild(document.createElement("br"));
11868
+ $content.appendChild(document.createTextNode(`Id: ${kw.id}`));
11869
+ popup.setLngLat(kw.coordinates).setDOMContent($content).addTo(map);
11870
+ return 0;
11871
+ }
11872
+ /************************************************************
11425
11873
  *
11426
11874
  ************************************************************/
11427
11875
  function ac_select(gobj, event, kw, src) {
@@ -11469,6 +11917,7 @@ function create_gclass$16(gclass_name) {
11469
11917
  ["EV_MAP_ON_LOAD", 0],
11470
11918
  ["EV_REFRESH", 0],
11471
11919
  ["EV_SELECT", 0],
11920
+ ["EV_MARKER_CLICKED", 0],
11472
11921
  ["EV_SHOW", 0],
11473
11922
  ["EV_HIDE", 0]
11474
11923
  ], [["ST_IDLE", [
@@ -11502,6 +11951,11 @@ function create_gclass$16(gclass_name) {
11502
11951
  ac_select,
11503
11952
  null
11504
11953
  ],
11954
+ [
11955
+ "EV_MARKER_CLICKED",
11956
+ ac_marker_clicked,
11957
+ null
11958
+ ],
11505
11959
  [
11506
11960
  "EV_SHOW",
11507
11961
  ac_show$11,
@@ -11668,7 +12122,7 @@ function build_ui$14(gobj) {
11668
12122
  class: "C_YUI_UPLOT",
11669
12123
  style: "overflow:auto;"
11670
12124
  }]);
11671
- (0, _yuneta_gobj_js.gobj_write_bool_attr)(gobj, "$container", $container);
12125
+ (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "$container", $container);
11672
12126
  (0, _yuneta_gobj_js.gobj_write_bool_attr)(gobj, "own_container", true);
11673
12127
  }
11674
12128
  let uPlot_options = {
@@ -13022,6 +13476,41 @@ function ensure_drag_canvas_patch() {
13022
13476
  __drag_canvas_patched__ = true;
13023
13477
  }
13024
13478
  //#endregion
13479
+ //#region src/g6_event_kw.js
13480
+ /***********************************************************************
13481
+ * g6_event_kw.js
13482
+ *
13483
+ * The kw an FSM event carries for a G6 pointer event: an identity
13484
+ * and three scalars, never the event. Shared by the three graphs
13485
+ * (C_G6_NODES_TREE, C_YUI_JSON_GRAPH, C_YUI_GOBJ_TREE_JS), which
13486
+ * each had a copy.
13487
+ *
13488
+ * Copyright (c) 2026, ArtGins.
13489
+ * All Rights Reserved.
13490
+ ***********************************************************************/
13491
+ /************************************************************
13492
+ * A G6 event, as PLAIN JSON.
13493
+ *
13494
+ * A kw is dumped by the `machine` trace (`trace_json(kw)`), and a
13495
+ * G6 / @antv/g event is circular: serializing one THROWS, so the
13496
+ * first thing a kw carrying `evt` breaks is the trace the FSM
13497
+ * exists to feed. It also drags a live graph element into a
13498
+ * message that may be read after that element is gone.
13499
+ *
13500
+ * What the actions read of it is an id and three scalars. The
13501
+ * event itself never leaves the callback that received it.
13502
+ ************************************************************/
13503
+ function g6_event_kw(evt) {
13504
+ let target = evt && evt.target ? evt.target : null;
13505
+ let client = evt && evt.client ? evt.client : null;
13506
+ return {
13507
+ id: target && target.id ? String(target.id) : "",
13508
+ shift: !!(evt && evt.shiftKey),
13509
+ client_x: client && typeof client.x === "number" ? client.x : 0,
13510
+ client_y: client && typeof client.y === "number" ? client.y : 0
13511
+ };
13512
+ }
13513
+ //#endregion
13025
13514
  //#region src/c_yui_json_graph.js
13026
13515
  /***********************************************************************
13027
13516
  * c_yui_json_graph.js
@@ -13030,7 +13519,7 @@ function ensure_drag_canvas_patch() {
13030
13519
  * Displays JSON data as a hierarchical graph visualization
13031
13520
  * Migrated from mx_json_viewer.js (mxGraph)
13032
13521
  *
13033
- * Copyright (c) 2025, ArtGins.
13522
+ * Copyright (c) 2025-2026, ArtGins.
13034
13523
  * All Rights Reserved.
13035
13524
  ***********************************************************************/
13036
13525
  /***************************************************************
@@ -13526,7 +14015,7 @@ function build_graph$4(gobj) {
13526
14015
  });
13527
14016
  if (priv.theme) graph.setTheme(priv.theme);
13528
14017
  graph.on(_antv_g6.NodeEvent.CLICK, (evt) => {
13529
- (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_CLICK", { evt }, gobj);
14018
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_CLICK", g6_event_kw(evt), gobj);
13530
14019
  });
13531
14020
  graph.on("aftertransform", () => {
13532
14021
  yui_graph_update_zoom((0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container"), priv.graph);
@@ -14457,11 +14946,13 @@ function ac_center$4(gobj, event, kw, src) {
14457
14946
  function ac_node_click$4(gobj, event, kw, src) {
14458
14947
  let priv = gobj.priv;
14459
14948
  let graph = priv.graph;
14460
- let node_id = kw.evt.target.id;
14949
+ let node_id = kw.id;
14461
14950
  let nodedata;
14462
14951
  try {
14463
14952
  nodedata = graph.getNodeData(node_id);
14464
- } catch (e) {}
14953
+ } catch (e) {
14954
+ (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: node '${node_id}' clicked, not in the graph: ${e}`);
14955
+ }
14465
14956
  if (priv.anchor_state === "arming") {
14466
14957
  priv.anchor_id = node_id;
14467
14958
  priv.anchor_path = nodedata && nodedata.data ? nodedata.data.path : "";
@@ -15346,7 +15837,7 @@ function push_collapsed_row(ctx, value, segments, depth, key, rows) {
15346
15837
  let key_spec = key === null || key === "" ? null : [
15347
15838
  "span",
15348
15839
  { class: "JSON_KEY" },
15349
- String(key)
15840
+ text_node(key)
15350
15841
  ];
15351
15842
  let stub_text = (info.is_array ? "[" : "{") + (size !== void 0 ? String(size) : "?") + (info.is_array ? "]" : "}");
15352
15843
  let children = [];
@@ -15361,7 +15852,7 @@ function push_collapsed_row(ctx, value, segments, depth, key, rows) {
15361
15852
  children.push([
15362
15853
  "span",
15363
15854
  { class: "JSON_STUB" },
15364
- stub_text
15855
+ text_node(stub_text)
15365
15856
  ]);
15366
15857
  children.push([
15367
15858
  "span",
@@ -15425,7 +15916,7 @@ function toggle_row(gobj, key, size, is_object, depth, path, open, value) {
15425
15916
  body.push([
15426
15917
  "span",
15427
15918
  { class: "JSON_KEY" },
15428
- String(key)
15919
+ text_node(key)
15429
15920
  ]);
15430
15921
  body.push([
15431
15922
  "span",
@@ -15442,7 +15933,7 @@ function toggle_row(gobj, key, size, is_object, depth, path, open, value) {
15442
15933
  if (label) body.push([
15443
15934
  "span",
15444
15935
  { class: "JSON_SUMMARY_ID ml-2" },
15445
- label
15936
+ text_node(label)
15446
15937
  ]);
15447
15938
  return [
15448
15939
  "div",
@@ -15488,7 +15979,7 @@ function leaf_row(key, value, depth) {
15488
15979
  body.push([
15489
15980
  "span",
15490
15981
  { class: "JSON_KEY" },
15491
- String(key)
15982
+ text_node(key)
15492
15983
  ]);
15493
15984
  body.push([
15494
15985
  "span",
@@ -15499,7 +15990,7 @@ function leaf_row(key, value, depth) {
15499
15990
  body.push([
15500
15991
  "span",
15501
15992
  { class: "JSON_VALUE JSON_TYPE_" + type.toUpperCase() },
15502
- text
15993
+ text_node(text)
15503
15994
  ]);
15504
15995
  if (key !== null && is_time_field(String(key))) {
15505
15996
  let wall = format_epoch(value);
@@ -16547,7 +17038,7 @@ function render_diff(gobj) {
16547
17038
  [
16548
17039
  "td",
16549
17040
  { class: "JSON_PAD_DIFF_PATH" },
16550
- row.id
17041
+ text_node(row.id)
16551
17042
  ],
16552
17043
  value_cell("JSON_PAD_DIFF_FROM", row, "from"),
16553
17044
  value_cell("JSON_PAD_DIFF_TO", row, "to")
@@ -18354,7 +18845,7 @@ function render_raw(gobj) {
18354
18845
  let children = [[
18355
18846
  "pre",
18356
18847
  { class: "GCLASS_RAW_BODY" },
18357
- dump.text
18848
+ document.createTextNode(String(dump.text))
18358
18849
  ]];
18359
18850
  if (dump.capped) children.push([
18360
18851
  "div",
@@ -18471,7 +18962,7 @@ function build_head(gobj, model) {
18471
18962
  for (let flag of model.gcflag) items.push([
18472
18963
  "span",
18473
18964
  { class: "GCLASS_CHIP GCLASS_GCFLAG" },
18474
- flag
18965
+ text_node(flag)
18475
18966
  ]);
18476
18967
  let current = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "current_state");
18477
18968
  if (current) items.push([
@@ -18533,6 +19024,10 @@ function build_zone(gobj, zone) {
18533
19024
  {
18534
19025
  class: "GCLASS_ZONE_TOGGLE",
18535
19026
  type: "button",
19027
+ title: (0, i18next.t)(zone.key),
19028
+ "data-i18n-title": zone.key,
19029
+ "aria-label": (0, i18next.t)(zone.key),
19030
+ "data-i18n-aria-label": zone.key,
18536
19031
  "aria-expanded": collapsed ? "false" : "true"
18537
19032
  },
18538
19033
  [
@@ -18630,7 +19125,7 @@ function flag_chips(flags) {
18630
19125
  return [
18631
19126
  "span",
18632
19127
  { class: cls },
18633
- flag
19128
+ text_node(flag)
18634
19129
  ];
18635
19130
  });
18636
19131
  }
@@ -18647,12 +19142,12 @@ function build_attrs(attrs) {
18647
19142
  [
18648
19143
  "td",
18649
19144
  { class: "GCLASS_CELL_KEY" },
18650
- a.id
19145
+ text_node(a.id)
18651
19146
  ],
18652
19147
  [
18653
19148
  "td",
18654
19149
  { class: "GCLASS_CELL_TYPE" },
18655
- a.type
19150
+ text_node(a.type)
18656
19151
  ],
18657
19152
  [
18658
19153
  "td",
@@ -18662,12 +19157,12 @@ function build_attrs(attrs) {
18662
19157
  [
18663
19158
  "td",
18664
19159
  { class: "GCLASS_CELL_DEFAULT" },
18665
- a.default_value
19160
+ text_node(a.default_value)
18666
19161
  ],
18667
19162
  [
18668
19163
  "td",
18669
19164
  { class: "GCLASS_CELL_DESC" },
18670
- a.description
19165
+ text_node(a.description)
18671
19166
  ]
18672
19167
  ]
18673
19168
  ];
@@ -18735,7 +19230,7 @@ function build_commands(commands) {
18735
19230
  [[
18736
19231
  "td",
18737
19232
  { colspan: "2" },
18738
- c.label
19233
+ text_node(c.label)
18739
19234
  ]]
18740
19235
  ]);
18741
19236
  continue;
@@ -18743,12 +19238,12 @@ function build_commands(commands) {
18743
19238
  let name_items = [[
18744
19239
  "span",
18745
19240
  { class: "GCLASS_CMD_NAME" },
18746
- c.id
19241
+ text_node(c.id)
18747
19242
  ]];
18748
19243
  for (let alias of c.alias) name_items.push([
18749
19244
  "span",
18750
19245
  { class: "GCLASS_CHIP GCLASS_ALIAS" },
18751
- alias
19246
+ text_node(alias)
18752
19247
  ]);
18753
19248
  name_items = name_items.concat(flag_chips(c.flags));
18754
19249
  rows.push([
@@ -18761,7 +19256,7 @@ function build_commands(commands) {
18761
19256
  ], [
18762
19257
  "td",
18763
19258
  { class: "GCLASS_CELL_DESC" },
18764
- c.description
19259
+ text_node(c.description)
18765
19260
  ]]
18766
19261
  ]);
18767
19262
  for (let p of c.parameters) rows.push([
@@ -18779,18 +19274,18 @@ function build_commands(commands) {
18779
19274
  [
18780
19275
  "span",
18781
19276
  { class: "GCLASS_PARAM_NAME" },
18782
- p.id
19277
+ text_node(p.id)
18783
19278
  ],
18784
19279
  [
18785
19280
  "span",
18786
19281
  { class: "GCLASS_PARAM_TYPE" },
18787
- p.type
19282
+ text_node(p.type)
18788
19283
  ]
18789
19284
  ].concat(flag_chips(p.flags))
18790
19285
  ], [
18791
19286
  "td",
18792
19287
  { class: "GCLASS_CELL_DESC" },
18793
- p.description
19288
+ text_node(p.description)
18794
19289
  ]]
18795
19290
  ]);
18796
19291
  }
@@ -18866,11 +19361,11 @@ function build_traces(levels) {
18866
19361
  [[
18867
19362
  "td",
18868
19363
  { class: "GCLASS_CELL_KEY" },
18869
- l.id
19364
+ text_node(l.id)
18870
19365
  ], [
18871
19366
  "td",
18872
19367
  { class: "GCLASS_CELL_DESC" },
18873
- l.description
19368
+ text_node(l.description)
18874
19369
  ]]
18875
19370
  ];
18876
19371
  })
@@ -18907,7 +19402,7 @@ function build_machine(gobj, fsm) {
18907
19402
  let items = [[
18908
19403
  "span",
18909
19404
  { class: "GCLASS_MX_STATE_NAME" },
18910
- state.name
19405
+ text_node(state.name)
18911
19406
  ]];
18912
19407
  if (state.name === current) cls += " is-current";
18913
19408
  if (unreachable.has(state.name)) {
@@ -18937,7 +19432,7 @@ function build_machine(gobj, fsm) {
18937
19432
  [[
18938
19433
  "span",
18939
19434
  {},
18940
- row.event
19435
+ text_node(row.event)
18941
19436
  ]].concat(event_flag_chips(row.flags))
18942
19437
  ]];
18943
19438
  row.cells.forEach(function(cell, i) {
@@ -18959,7 +19454,7 @@ function build_machine(gobj, fsm) {
18959
19454
  if (cell.action) items.push([
18960
19455
  "span",
18961
19456
  { class: "GCLASS_MX_ACTION" },
18962
- cell.action
19457
+ text_node(cell.action)
18963
19458
  ]);
18964
19459
  else if (cell.has_action) items.push([
18965
19460
  "span",
@@ -18988,7 +19483,7 @@ function build_machine(gobj, fsm) {
18988
19483
  items.push([
18989
19484
  "span",
18990
19485
  { class: "GCLASS_MX_NEXT" },
18991
- cell.next_state
19486
+ text_node(cell.next_state)
18992
19487
  ]);
18993
19488
  }
18994
19489
  cells.push([
@@ -19040,7 +19535,7 @@ function build_machine(gobj, fsm) {
19040
19535
  [[
19041
19536
  "span",
19042
19537
  { class: "GCLASS_CHIP GCLASS_PUB_EVENT" },
19043
- p.event
19538
+ text_node(p.event)
19044
19539
  ]].concat(event_flag_chips(p.flags))
19045
19540
  ];
19046
19541
  })
@@ -20543,6 +21038,10 @@ function mt_destroy$9(gobj) {
20543
21038
  cancelAnimationFrame(priv._resize_raf);
20544
21039
  priv._resize_raf = 0;
20545
21040
  }
21041
+ if (priv.find_timer) {
21042
+ clearTimeout(priv.find_timer);
21043
+ priv.find_timer = null;
21044
+ }
20546
21045
  if (priv.graph) {
20547
21046
  priv.graph.destroy();
20548
21047
  priv.graph = null;
@@ -20949,7 +21448,7 @@ function build_graph$2(gobj) {
20949
21448
  save_view_state(gobj);
20950
21449
  });
20951
21450
  graph.on(_antv_g6.NodeEvent.CLICK, (evt) => {
20952
- (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_CLICK", { evt }, gobj);
21451
+ (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_NODE_CLICK", g6_event_kw(evt), gobj);
20953
21452
  });
20954
21453
  graph.on(_antv_g6.CanvasEvent.CLICK, (evt) => {
20955
21454
  hide_popover(gobj);
@@ -21961,12 +22460,14 @@ function ac_center$2(gobj, event, kw, src) {
21961
22460
  function ac_node_click$3(gobj, event, kw, src) {
21962
22461
  let priv = gobj.priv;
21963
22462
  let graph = priv.graph;
21964
- let node_id = kw.evt.target.id;
22463
+ let node_id = kw.id;
21965
22464
  let node_data = priv.node_by_id && priv.node_by_id[node_id] || null;
21966
22465
  if (!node_data) try {
21967
22466
  let nd = graph.getNodeData(node_id);
21968
22467
  if (nd && nd.data) node_data = nd.data;
21969
- } catch (e) {}
22468
+ } catch (e) {
22469
+ (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: node '${node_id}' clicked, not in the graph: ${e}`);
22470
+ }
21970
22471
  if (!node_data) return 0;
21971
22472
  if (priv.anchor_state === "arming") {
21972
22473
  priv.anchor_id = node_id;
@@ -21977,8 +22478,8 @@ function ac_node_click$3(gobj, event, kw, src) {
21977
22478
  (0, _yuneta_gobj_js.gobj_post_event)(gobj, "EV_CENTER_ANCHOR", {}, gobj);
21978
22479
  return 0;
21979
22480
  }
21980
- let client_x = kw.evt && kw.evt.client ? kw.evt.client.x : 0;
21981
- let client_y = kw.evt && kw.evt.client ? kw.evt.client.y : 0;
22481
+ let client_x = kw.client_x || 0;
22482
+ let client_y = kw.client_y || 0;
21982
22483
  show_popover(gobj, node_data, client_x, client_y);
21983
22484
  return 0;
21984
22485
  }
@@ -22497,7 +22998,7 @@ function card_descriptor(it, show_label) {
22497
22998
  class: "yui-nav-label",
22498
22999
  i18n: label
22499
23000
  },
22500
- label
23001
+ text_node(label)
22501
23002
  ]);
22502
23003
  let a_attrs = {
22503
23004
  class: "yui-nav-item yui-nav-card",
@@ -22629,7 +23130,7 @@ function is_decorative(it) {
22629
23130
  var attrs_table$7 = [
22630
23131
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
22631
23132
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "menu_id", 0, "", "Id of the menu this nav renders"),
22632
- (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "nav_label", 0, "", "Human-readable label for aria/heading; falls back to menu_id"),
23133
+ (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "nav_label", 0, "", "i18n key of the label for aria/heading; falls back to 'navigation'"),
22633
23134
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_JSON, "menu_items", 0, null, "Array of menu items to render"),
22634
23135
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "zone", 0, "", "Zone id where this nav lives"),
22635
23136
  (0, _yuneta_gobj_js.SDATA)(_yuneta_gobj_js.data_type_t.DTP_STRING, "layout", 0, "vertical", "vertical|icon-bar|tabs|drawer|submenu|accordion"),
@@ -22644,7 +23145,10 @@ var attrs_table$7 = [
22644
23145
  (0, _yuneta_gobj_js.SDATA_END)()
22645
23146
  ];
22646
23147
  var __nav_aria_seq__ = 0;
22647
- var PRIVATE_DATA$7 = { click_handler: null };
23148
+ var PRIVATE_DATA$7 = {
23149
+ click_handler: null,
23150
+ key_handler: null
23151
+ };
22648
23152
  var __gclass__$7 = null;
22649
23153
  /******************************
22650
23154
  * Framework Methods
@@ -22680,6 +23184,7 @@ function mt_destroy$7(gobj) {
22680
23184
  let $c = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
22681
23185
  let priv = gobj.priv;
22682
23186
  if ($c && priv && priv.click_handler) $c.removeEventListener("click", priv.click_handler);
23187
+ if ($c && priv && priv.key_handler) $c.removeEventListener("keydown", priv.key_handler);
22683
23188
  if ($c && $c.parentNode) $c.parentNode.removeChild($c);
22684
23189
  (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "$container", null);
22685
23190
  }
@@ -22697,7 +23202,7 @@ function build_ui$7(gobj) {
22697
23202
  }
22698
23203
  let items = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "menu_items") || [];
22699
23204
  let zone = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "zone") || "";
22700
- let menu_id = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "menu_id") || "nav";
23205
+ (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "menu_id");
22701
23206
  let $container;
22702
23207
  switch (layout) {
22703
23208
  case "vertical":
@@ -22741,8 +23246,9 @@ function build_ui$7(gobj) {
22741
23246
  if (layout !== "drawer") {
22742
23247
  $container.setAttribute("role", "navigation");
22743
23248
  if (!$container.hasAttribute("aria-label")) {
22744
- let label = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "nav_label") || menu_id;
22745
- $container.setAttribute("aria-label", label);
23249
+ let label = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "nav_label") || "navigation";
23250
+ $container.setAttribute("aria-label", (0, i18next.t)(label));
23251
+ $container.setAttribute("data-i18n-aria-label", label);
22746
23252
  }
22747
23253
  }
22748
23254
  wire_clicks(gobj, $container);
@@ -22761,6 +23267,7 @@ function rebuild(gobj) {
22761
23267
  let next = $old ? $old.nextSibling : null;
22762
23268
  let was_hidden = !!($old && $old.classList.contains("is-hidden"));
22763
23269
  if ($old && priv.click_handler) $old.removeEventListener("click", priv.click_handler);
23270
+ if ($old && priv.key_handler) $old.removeEventListener("keydown", priv.key_handler);
22764
23271
  build_ui$7(gobj);
22765
23272
  let $new = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
22766
23273
  if ($new && was_hidden) $new.classList.add("is-hidden");
@@ -22857,7 +23364,7 @@ function render_tabs(gobj, items) {
22857
23364
  if (show_label && !(0, _yuneta_gobj_js.empty_string)(it.name)) children.push([
22858
23365
  "span",
22859
23366
  { i18n: it.name },
22860
- it.name
23367
+ text_node(it.name)
22861
23368
  ]);
22862
23369
  if (it.closable) children.push([
22863
23370
  "span",
@@ -22865,6 +23372,7 @@ function render_tabs(gobj, items) {
22865
23372
  class: "icon is-small yui-nav-close ml-2",
22866
23373
  "data-close-item": it.id,
22867
23374
  role: "button",
23375
+ tabindex: "0",
22868
23376
  "aria-label": (0, i18next.t)("close"),
22869
23377
  "data-i18n-aria-label": "close",
22870
23378
  title: (0, i18next.t)("close"),
@@ -22875,12 +23383,15 @@ function render_tabs(gobj, items) {
22875
23383
  "aria-hidden": "true"
22876
23384
  }]
22877
23385
  ]);
23386
+ let label = it.name || "";
22878
23387
  let a_attrs = {
22879
23388
  href: it.route ? "#" + it.route : "#",
22880
23389
  "data-item-id": it.id,
22881
- "data-route": it.route || ""
23390
+ "data-route": it.route || "",
23391
+ "aria-label": label || it.id
22882
23392
  };
22883
- let tip = it.tooltip || it.aria_label;
23393
+ if (label) a_attrs["data-i18n-aria-label"] = label;
23394
+ let tip = it.tooltip || it.aria_label || label;
22884
23395
  if (tip) {
22885
23396
  a_attrs.title = tip;
22886
23397
  a_attrs["data-i18n-title"] = tip;
@@ -22953,7 +23464,7 @@ function render_breadcrumb(gobj, items) {
22953
23464
  class: "yui-nav-label",
22954
23465
  i18n: label
22955
23466
  },
22956
- label
23467
+ text_node(label)
22957
23468
  ]);
22958
23469
  }
22959
23470
  let a_attrs = {
@@ -23020,18 +23531,19 @@ function render_backbar(gobj) {
23020
23531
  ], [
23021
23532
  "span",
23022
23533
  label_attrs,
23023
- label
23534
+ text_node(label)
23024
23535
  ]]
23025
23536
  ]
23026
23537
  ]);
23027
23538
  }
23028
23539
  function render_drawer(gobj, items) {
23029
- let menu_id = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "menu_id") || "drawer";
23030
23540
  let wrap = document.createElement("div");
23031
23541
  wrap.className = "yui-drawer";
23032
23542
  wrap.setAttribute("role", "dialog");
23033
23543
  wrap.setAttribute("aria-modal", "true");
23034
- wrap.setAttribute("aria-label", menu_id);
23544
+ let nav_label = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "nav_label") || "navigation";
23545
+ wrap.setAttribute("aria-label", (0, i18next.t)(nav_label));
23546
+ wrap.setAttribute("data-i18n-aria-label", nav_label);
23035
23547
  let back = document.createElement("div");
23036
23548
  back.className = "yui-drawer-backdrop";
23037
23549
  back.setAttribute("data-close-drawer", "1");
@@ -23039,7 +23551,8 @@ function render_drawer(gobj, items) {
23039
23551
  let panel = document.createElement("div");
23040
23552
  panel.className = "yui-drawer-panel";
23041
23553
  panel.setAttribute("role", "navigation");
23042
- panel.setAttribute("aria-label", menu_id);
23554
+ panel.setAttribute("aria-label", (0, i18next.t)(nav_label));
23555
+ panel.setAttribute("data-i18n-aria-label", nav_label);
23043
23556
  panel.appendChild(render_vertical(gobj, items));
23044
23557
  wrap.appendChild(back);
23045
23558
  wrap.appendChild(panel);
@@ -23093,7 +23606,13 @@ function render_accordion(gobj, items) {
23093
23606
  "aria-expanded": "false",
23094
23607
  "aria-controls": body_id
23095
23608
  };
23096
- if (!(0, _yuneta_gobj_js.empty_string)(head_text)) head_attrs.i18n = head_text;
23609
+ if (!(0, _yuneta_gobj_js.empty_string)(head_text)) {
23610
+ head_attrs.i18n = head_text;
23611
+ head_attrs.title = head_text;
23612
+ head_attrs["data-i18n-title"] = head_text;
23613
+ head_attrs["aria-label"] = head_text;
23614
+ head_attrs["data-i18n-aria-label"] = head_text;
23615
+ }
23097
23616
  let $hdr = (0, _yuneta_gobj_js.createElement2)([
23098
23617
  "button",
23099
23618
  head_attrs,
@@ -23137,7 +23656,7 @@ function item_li(gobj, it, opts) {
23137
23656
  [
23138
23657
  "span",
23139
23658
  span_attrs,
23140
- label
23659
+ text_node(label)
23141
23660
  ]
23142
23661
  ];
23143
23662
  }
@@ -23158,7 +23677,7 @@ function item_li(gobj, it, opts) {
23158
23677
  class: "yui-nav-label",
23159
23678
  i18n: label
23160
23679
  },
23161
- label
23680
+ text_node(label)
23162
23681
  ] : null;
23163
23682
  let a_class = "yui-nav-item";
23164
23683
  if (stacked || icon_pos === "top" || icon_pos === "bottom") a_class += " yui-nav-stacked";
@@ -23179,7 +23698,7 @@ function item_li(gobj, it, opts) {
23179
23698
  "aria-label": aria_key
23180
23699
  };
23181
23700
  if (label) a_attrs["data-i18n-aria-label"] = label;
23182
- let tip = it.tooltip || it.aria_label;
23701
+ let tip = it.tooltip || it.aria_label || label;
23183
23702
  if (tip) {
23184
23703
  a_attrs.title = tip;
23185
23704
  a_attrs["data-i18n-title"] = tip;
@@ -23215,7 +23734,7 @@ function item_iconbar(gobj, it, opts) {
23215
23734
  class: "yui-nav-label is-size-7",
23216
23735
  i18n: label
23217
23736
  },
23218
- label
23737
+ text_node(label)
23219
23738
  ] : null;
23220
23739
  let children = [];
23221
23740
  if (icon_pos === "bottom") {
@@ -23233,7 +23752,7 @@ function item_iconbar(gobj, it, opts) {
23233
23752
  "aria-label": label || it.id
23234
23753
  };
23235
23754
  if (label) a_attrs["data-i18n-aria-label"] = label;
23236
- let tip = it.tooltip || it.aria_label;
23755
+ let tip = it.tooltip || it.aria_label || label;
23237
23756
  if (tip) {
23238
23757
  a_attrs.title = tip;
23239
23758
  a_attrs["data-i18n-title"] = tip;
@@ -23301,6 +23820,14 @@ function wire_clicks(gobj, $container) {
23301
23820
  };
23302
23821
  $container.addEventListener("click", handler);
23303
23822
  priv.click_handler = handler;
23823
+ let key_handler = (ev) => {
23824
+ if (ev.key !== "Enter" && ev.key !== " ") return;
23825
+ let target = ev.target;
23826
+ if (!target || !target.closest || !target.closest("[data-close-item]")) return;
23827
+ handler(ev);
23828
+ };
23829
+ $container.addEventListener("keydown", key_handler);
23830
+ priv.key_handler = key_handler;
23304
23831
  }
23305
23832
  /***************************
23306
23833
  * Actions
@@ -23355,7 +23882,7 @@ function ac_route_changed(gobj, event, kw, src) {
23355
23882
  return 0;
23356
23883
  }
23357
23884
  function css_escape(s) {
23358
- return String(s).replace(/"/g, "\\\"");
23885
+ return String(s).replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
23359
23886
  }
23360
23887
  /***************************************************************
23361
23888
  * FSM
@@ -23422,12 +23949,12 @@ function render_node(node) {
23422
23949
  class: "ROUTEMAP_NAME",
23423
23950
  i18n: node.label
23424
23951
  },
23425
- node.label
23952
+ text_node(node.label)
23426
23953
  ]);
23427
23954
  if (node.route) row.push([
23428
23955
  "code",
23429
23956
  { class: "ROUTEMAP_ROUTE" },
23430
- node.route
23957
+ text_node(node.route)
23431
23958
  ]);
23432
23959
  if (node.gclass) row.push([
23433
23960
  "span",
@@ -23441,7 +23968,7 @@ function render_node(node) {
23441
23968
  if (node.event) row.push([
23442
23969
  "span",
23443
23970
  { class: "ROUTEMAP_EVENT" },
23444
- node.event
23971
+ text_node(node.event)
23445
23972
  ]);
23446
23973
  if (node.ref) row.push([
23447
23974
  "span",
@@ -23575,6 +24102,8 @@ function build_body(shell, t) {
23575
24102
  type: "text",
23576
24103
  placeholder: t("filter", { defaultValue: "Filter…" }),
23577
24104
  "data-i18n-placeholder": "filter",
24105
+ title: t("filter", { defaultValue: "Filter" }),
24106
+ "data-i18n-title": "filter",
23578
24107
  "aria-label": t("filter", { defaultValue: "Filter" }),
23579
24108
  "data-i18n-aria-label": "filter"
23580
24109
  }]);
@@ -23662,6 +24191,10 @@ function build_body(shell, t) {
23662
24191
  "button",
23663
24192
  {
23664
24193
  class: "button is-small ROUTEMAP_PRINT",
24194
+ title: t("print", { defaultValue: "Print" }),
24195
+ "data-i18n-title": "print",
24196
+ "aria-label": t("print", { defaultValue: "Print" }),
24197
+ "data-i18n-aria-label": "print",
23665
24198
  i18n: "print"
23666
24199
  },
23667
24200
  t("print", { defaultValue: "Print" })
@@ -24651,7 +25184,7 @@ function build_ui$6(gobj) {
24651
25184
  ], [
24652
25185
  "span",
24653
25186
  { class: "TREEDB_TOPICS_SOURCE_URL" },
24654
- source_url
25187
+ text_node(source_url)
24655
25188
  ]]
24656
25189
  ],
24657
25190
  ...graph_items,
@@ -24822,7 +25355,7 @@ function add_tab(gobj, gobj2, id, text, icon) {
24822
25355
  i18n: text,
24823
25356
  class: ""
24824
25357
  },
24825
- text
25358
+ text_node(text)
24826
25359
  ]));
24827
25360
  (0, _yuneta_gobj_js.refresh_language)($a, i18next.t);
24828
25361
  $a.addEventListener("click", function(ev) {
@@ -25019,7 +25552,7 @@ function add_topic_card(gobj, id, text, icon, desc) {
25019
25552
  class: "yui-nav-label",
25020
25553
  i18n: text
25021
25554
  },
25022
- text
25555
+ text_node(text)
25023
25556
  ]]
25024
25557
  ]);
25025
25558
  $card.addEventListener("click", function(ev) {
@@ -25048,7 +25581,7 @@ function add_topic_card(gobj, id, text, icon, desc) {
25048
25581
  class: "TREEDB_TOPIC_CARD_NAME",
25049
25582
  i18n: text
25050
25583
  },
25051
- text
25584
+ text_node(text)
25052
25585
  ],
25053
25586
  ...topic_card_meta(desc),
25054
25587
  [
@@ -25265,7 +25798,7 @@ function build_topic_info_panel(gobj, $info, topic, desc) {
25265
25798
  if (pkey) push_meta("pkey", [
25266
25799
  "code",
25267
25800
  {},
25268
- pkey
25801
+ text_node(pkey)
25269
25802
  ]);
25270
25803
  if (pkey2s.length > 0) push_meta("pkey2s", [
25271
25804
  "span",
@@ -25273,13 +25806,13 @@ function build_topic_info_panel(gobj, $info, topic, desc) {
25273
25806
  pkey2s.map((name) => [
25274
25807
  "span",
25275
25808
  { class: "tag is-warning" },
25276
- name
25809
+ text_node(name)
25277
25810
  ])
25278
25811
  ]);
25279
25812
  push_meta("tkey", tkey ? [
25280
25813
  "code",
25281
25814
  {},
25282
- tkey
25815
+ text_node(tkey)
25283
25816
  ] : [
25284
25817
  "span",
25285
25818
  {
@@ -27202,46 +27735,46 @@ function yui_selection_bar(t, opts) {
27202
27735
  /***********************************************************************
27203
27736
  * yui_table_filter_clear.js
27204
27737
  *
27205
- * LA ✕ DE LOS FILTROS DE CABECERA DE UNA TABULATOR.
27206
- *
27207
- * Un filtro de columna se pone escribiendo y se quita BORRANDO lo
27208
- * escrito, letra a letra, y no hay nada en la cabecera que diga
27209
- * que se puede quitar. Con varias columnas filtradas, volver a
27210
- * ver la tabla entera es un ejercicio de memoria: cuáles toqué.
27211
- * La ✕ lo dice y lo hace.
27212
- *
27213
- * TRES DECISIONES QUE NO SON OBVIAS:
27214
- *
27215
- * - **Se ve mientras el filtro tenga contenido, con foco o sin
27216
- * él.** Es al revés que la ✕ de un formulario
27217
- * (`yui_inputs.js`), que sólo aparece en el campo que se está
27218
- * editando para no encender un aspa en cada campo relleno. Aquí
27219
- * el caso de uso es justo el contrario: el filtro ya está puesto,
27220
- * el foco está en otra parte, y lo que se quiere es verlo y
27221
- * quitarlo. Escondida tras el foco harían falta dos clics.
27222
- *
27223
- * - **Se borra con la API, no simulando teclas.**
27224
- * `setHeaderFilterValue(field, "")` es lo que Tabulator ofrece, y
27225
- * deja el valor y el filtro consistentes. Sintetizar un `input`
27226
- * sobre el `<input>` depende de a qué escuche el editor de ese
27227
- * filtro, que cambia con el tipo de columna.
27228
- *
27229
- * - **Se recorre la cabecera, no se envuelve el editor.** Las
27230
- * columnas se construyen del esquema del topic, así que no hay un
27231
- * sitio único donde envolver el editor; y la cabecera se rehace
27232
- * sola cuando cambian las columnas. El recorrido es idempotente
27233
- * -- marca lo que ya tiene aspa -- y se dispara con un
27234
- * `querySelector` de una sola pasada, así que repetirlo en cada
27235
- * render no cuesta nada.
27738
+ * THE ✕ OF A TABULATOR'S HEADER FILTERS.
27739
+ *
27740
+ * A column filter is set by typing and removed by DELETING what
27741
+ * was typed, letter by letter, and nothing in the header says it
27742
+ * can be removed. With several columns filtered, getting the
27743
+ * whole table back is an exercise of memory: which ones did I
27744
+ * touch. The ✕ says it and does it.
27745
+ *
27746
+ * THREE DECISIONS THAT ARE NOT OBVIOUS:
27747
+ *
27748
+ * - **It shows while the filter has content, focused or not.**
27749
+ * The opposite of a form's ✕ (`yui_inputs.js`), which appears
27750
+ * only on the field being edited so as not to light a cross on
27751
+ * every filled field. Here the use case is the reverse: the
27752
+ * filter is already set, the focus is elsewhere, and what is
27753
+ * wanted is to see it and remove it. Hidden behind the focus it
27754
+ * would take two clicks.
27755
+ *
27756
+ * - **It clears through the API, not by faking keys.**
27757
+ * `setHeaderFilterValue(field, "")` is what Tabulator offers,
27758
+ * and it keeps the value and the filter consistent. Synthesising
27759
+ * an `input` on the `<input>` depends on what that filter's
27760
+ * editor listens to, which changes with the column type.
27761
+ *
27762
+ * - **The header is walked, the editor is not wrapped.** The
27763
+ * columns are built from the topic's schema, so there is no
27764
+ * single place to wrap the editor; and the header rebuilds
27765
+ * itself when the columns change. The walk is idempotent -- it
27766
+ * marks what already has its cross -- and is triggered by a
27767
+ * one-pass `querySelector`, so repeating it on every render
27768
+ * costs nothing.
27236
27769
  *
27237
27770
  * Copyright (c) 2026, ArtGins.
27238
27771
  * All Rights Reserved.
27239
27772
  ***********************************************************************/
27240
27773
  var MARK = "data-yui-filter-clear";
27241
27774
  /***************************************************************
27242
- * Pon (o repón) la ✕ de cada filtro de cabecera de `table`.
27775
+ * Put (or put back) the ✕ of every header filter of `table`.
27243
27776
  *
27244
- * Idempotente: los que ya la tienen se saltan.
27777
+ * Idempotent: the ones that already have it are skipped.
27245
27778
  ***************************************************************/
27246
27779
  function decorate(table) {
27247
27780
  if (!table || !table.element) return;
@@ -27279,11 +27812,11 @@ function decorate(table) {
27279
27812
  }
27280
27813
  }
27281
27814
  /***************************************************************
27282
- * Engancha la ✕ a una tabla ya creada.
27815
+ * Hook the ✕ onto a table already created.
27283
27816
  *
27284
- * Se llama una vez, con la tabla construida. Los enganches
27285
- * cubren los dos momentos en que la cabecera aparece o se
27286
- * rehace: cuando se construye y cuando cambian las columnas.
27817
+ * Called once, with the table built. The hooks cover the two
27818
+ * moments the header appears or is rebuilt: when it is built
27819
+ * and when the columns change.
27287
27820
  ***************************************************************/
27288
27821
  function yui_table_filter_clear(table) {
27289
27822
  if (!table) return;
@@ -27933,6 +28466,7 @@ function mt_stop$5(gobj) {
27933
28466
  close_cell_file_dialog(gobj);
27934
28467
  close_hook_choice(gobj);
27935
28468
  drop_pending_assets(gobj);
28469
+ drop_pending_pages(gobj);
27936
28470
  table__destroy(gobj);
27937
28471
  }
27938
28472
  /***************************************************************
@@ -28852,6 +29386,7 @@ function create_tabulator(gobj) {
28852
29386
  else try {
28853
29387
  n = tabulator.getDataCount("active");
28854
29388
  } catch (e) {
29389
+ (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot count the table's rows: ${e}`);
28855
29390
  n = 0;
28856
29391
  }
28857
29392
  let paged = (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "with_remote_paging");
@@ -29081,12 +29616,14 @@ function build_json_cell_preview(value) {
29081
29616
  {
29082
29617
  class: "JSON_CELL",
29083
29618
  title: (0, i18next.t)("show json"),
29084
- "data-i18n-title": "show json"
29619
+ "data-i18n-title": "show json",
29620
+ "aria-label": (0, i18next.t)("show json"),
29621
+ "data-i18n-aria-label": "show json"
29085
29622
  },
29086
29623
  [["span", { class: "JSON_CELL_ICON icon yi-eye" }], [
29087
29624
  "span",
29088
29625
  { class: "JSON_CELL_PREVIEW" },
29089
- text
29626
+ text_node(text)
29090
29627
  ]]
29091
29628
  ]);
29092
29629
  }
@@ -29699,7 +30236,7 @@ function open_cell_file_dialog(gobj, row_id, col_id) {
29699
30236
  [[
29700
30237
  "span",
29701
30238
  { class: "CELL_FILE_ID" },
29702
- id
30239
+ text_node(id)
29703
30240
  ]]
29704
30241
  ]]
29705
30242
  ]));
@@ -29758,7 +30295,7 @@ function fill_cell_file_slot(gobj, pend, answer, error) {
29758
30295
  if (meta) $caption.appendChild((0, _yuneta_gobj_js.createElement2)([
29759
30296
  "span",
29760
30297
  { class: "CELL_FILE_META" },
29761
- meta
30298
+ text_node(meta)
29762
30299
  ]));
29763
30300
  let $open = yui_asset_open_link(answer);
29764
30301
  if ($open) $caption.appendChild($open);
@@ -29835,7 +30372,7 @@ function open_hook_choice_dialog(gobj, targets, parent_id, hook) {
29835
30372
  [[
29836
30373
  "span",
29837
30374
  { i18n: tg.topic_name },
29838
- tg.topic_name
30375
+ text_node(tg.topic_name)
29839
30376
  ]],
29840
30377
  { click: () => {
29841
30378
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_CHOOSE_LINKED", {
@@ -30081,33 +30618,15 @@ function transform__form_value_2_treedb_value(gobj, col, value, operation) {
30081
30618
  case "object":
30082
30619
  case "dict":
30083
30620
  case "template":
30084
- if ((0, _yuneta_gobj_js.is_string)(value)) try {
30085
- value = JSON.parse(value);
30086
- } catch (e) {
30087
- value = {};
30088
- }
30089
- else if ((0, _yuneta_gobj_js.is_object)(value)) {}
30090
- if (!(0, _yuneta_gobj_js.is_object)(value)) value = {};
30091
- break;
30092
30621
  case "array":
30093
30622
  case "list":
30094
- if ((0, _yuneta_gobj_js.is_string)(value)) try {
30095
- value = JSON.parse(value);
30096
- } catch (e) {
30097
- value = [];
30098
- }
30099
- else if ((0, _yuneta_gobj_js.is_array)(value)) {}
30100
- if (!(0, _yuneta_gobj_js.is_array)(value)) value = [];
30101
- break;
30102
30623
  case "coordinates":
30103
- case "blob":
30104
- if ((0, _yuneta_gobj_js.is_string)(value)) try {
30105
- value = JSON.parse(value);
30106
- } catch (e) {
30107
- value = {};
30108
- }
30109
- else if ((0, _yuneta_gobj_js.is_object)(value)) {} else if ((0, _yuneta_gobj_js.is_array)(value)) {} else value = {};
30624
+ case "blob": {
30625
+ let r = parse_json_field(value, field_desc.type);
30626
+ if (r.error) (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: column '${col.id}' (${field_desc.type}) holds no valid json, handed on as it is`);
30627
+ else value = r.value;
30110
30628
  break;
30629
+ }
30111
30630
  case "enum":
30112
30631
  switch (field_desc.real_type) {
30113
30632
  case "string":
@@ -31066,6 +31585,21 @@ function request_page(gobj, page, size) {
31066
31585
  });
31067
31586
  }
31068
31587
  /************************************************************
31588
+ * The view stops: no page request is waited for any more. Each
31589
+ * one's watchdog would otherwise fire EV_PAGE_TIMEOUT on a gobj
31590
+ * stopped -- or destroyed -- 20 s later.
31591
+ ************************************************************/
31592
+ function drop_pending_pages(gobj) {
31593
+ let priv = gobj.priv;
31594
+ let pending = priv._pending_pages || {};
31595
+ priv._pending_pages = {};
31596
+ for (let req_id of Object.keys(pending)) {
31597
+ let pend = pending[req_id];
31598
+ if (pend.timer) window.clearTimeout(pend.timer);
31599
+ pend.reject(/* @__PURE__ */ new Error("the view stopped"));
31600
+ }
31601
+ }
31602
+ /************************************************************
31069
31603
  * Settle a parked page request, however it ended.
31070
31604
  ************************************************************/
31071
31605
  function settle_page(gobj, req_id, value, error) {
@@ -60087,6 +60621,7 @@ var attrs_table$4 = [
60087
60621
  (0, _yuneta_gobj_js.SDATA_END)()
60088
60622
  ];
60089
60623
  var PRIVATE_DATA$4 = {
60624
+ _drag_unwire: null,
60090
60625
  anchor_id: "",
60091
60626
  anchor_state: "off",
60092
60627
  last_zoom: 1,
@@ -60246,6 +60781,10 @@ function mt_stop$4(gobj) {
60246
60781
  function mt_destroy$4(gobj) {
60247
60782
  let priv = gobj.priv;
60248
60783
  uninstall_fold_listener(gobj);
60784
+ if (priv._drag_unwire) {
60785
+ priv._drag_unwire();
60786
+ priv._drag_unwire = null;
60787
+ }
60249
60788
  if (priv._on_pointerdown_focus) {
60250
60789
  priv.$container.removeEventListener("pointerdown", priv._on_pointerdown_focus, true);
60251
60790
  priv._on_pointerdown_focus = null;
@@ -60401,28 +60940,6 @@ function build_graph$1(gobj) {
60401
60940
  });
60402
60941
  }
60403
60942
  /************************************************************
60404
- * A G6 event, as PLAIN JSON.
60405
- *
60406
- * A kw is dumped by the `machine` trace (`trace_json(kw)`), and a
60407
- * G6 / @antv/g event is circular: serializing one THROWS, so the
60408
- * first thing a kw carrying `evt` breaks is the trace the FSM
60409
- * exists to feed. It also drags a live graph element into a
60410
- * message that may be read after that element is gone.
60411
- *
60412
- * What the actions read of it is an id and three scalars. The
60413
- * event itself never leaves the callback that received it.
60414
- ************************************************************/
60415
- function g6_event_kw(evt) {
60416
- let target = evt && evt.target ? evt.target : null;
60417
- let client = evt && evt.client ? evt.client : null;
60418
- return {
60419
- id: target && target.id ? String(target.id) : "",
60420
- shift: !!(evt && evt.shiftKey),
60421
- client_x: client && typeof client.x === "number" ? client.x : 0,
60422
- client_y: client && typeof client.y === "number" ? client.y : 0
60423
- };
60424
- }
60425
- /************************************************************
60426
60943
  * Configure G6 event handlers
60427
60944
  ************************************************************/
60428
60945
  function configure_events(gobj) {
@@ -63354,6 +63871,7 @@ function start_node_resize(gobj, e, mx, my) {
63354
63871
  function onPointerUp(ev) {
63355
63872
  document.removeEventListener("pointermove", onPointerMove);
63356
63873
  document.removeEventListener("pointerup", onPointerUp);
63874
+ document.removeEventListener("pointercancel", onPointerCancel);
63357
63875
  const dLeft = (currentRect.left - origVpRect.left) / zoom;
63358
63876
  const dTop = (currentRect.top - origVpRect.top) / zoom;
63359
63877
  const dRight = (currentRect.right - origVpRect.right) / zoom;
@@ -63387,8 +63905,20 @@ function start_node_resize(gobj, e, mx, my) {
63387
63905
  mark_graph_dirty(gobj);
63388
63906
  });
63389
63907
  }
63908
+ function onPointerCancel(ev) {
63909
+ document.removeEventListener("pointermove", onPointerMove);
63910
+ document.removeEventListener("pointerup", onPointerUp);
63911
+ document.removeEventListener("pointercancel", onPointerCancel);
63912
+ update_resize_handles_position(gobj);
63913
+ }
63390
63914
  document.addEventListener("pointermove", onPointerMove);
63391
63915
  document.addEventListener("pointerup", onPointerUp);
63916
+ document.addEventListener("pointercancel", onPointerCancel);
63917
+ gobj.priv._drag_unwire = function() {
63918
+ document.removeEventListener("pointermove", onPointerMove);
63919
+ document.removeEventListener("pointerup", onPointerUp);
63920
+ document.removeEventListener("pointercancel", onPointerCancel);
63921
+ };
63392
63922
  }
63393
63923
  /************************************************************
63394
63924
  * Port selection and individual port resizing
@@ -63976,6 +64506,7 @@ function start_link_drag(gobj, e) {
63976
64506
  function onPointerUp(ev) {
63977
64507
  document.removeEventListener("pointermove", onPointerMove);
63978
64508
  document.removeEventListener("pointerup", onPointerUp);
64509
+ document.removeEventListener("pointercancel", onPointerCancel);
63979
64510
  priv.$container.style.cursor = "";
63980
64511
  if (priv._link_drag_svg) {
63981
64512
  priv._link_drag_svg.remove();
@@ -63989,8 +64520,25 @@ function start_link_drag(gobj, e) {
63989
64520
  if (target) try_complete_link(gobj, target.node_id, target.port_key);
63990
64521
  else exit_linking_mode(gobj);
63991
64522
  }
64523
+ function onPointerCancel(ev) {
64524
+ document.removeEventListener("pointermove", onPointerMove);
64525
+ document.removeEventListener("pointerup", onPointerUp);
64526
+ document.removeEventListener("pointercancel", onPointerCancel);
64527
+ priv.$container.style.cursor = "";
64528
+ if (priv._link_drag_svg) {
64529
+ priv._link_drag_svg.remove();
64530
+ priv._link_drag_svg = null;
64531
+ }
64532
+ exit_linking_mode(gobj);
64533
+ }
63992
64534
  document.addEventListener("pointermove", onPointerMove);
63993
64535
  document.addEventListener("pointerup", onPointerUp);
64536
+ document.addEventListener("pointercancel", onPointerCancel);
64537
+ gobj.priv._drag_unwire = function() {
64538
+ document.removeEventListener("pointermove", onPointerMove);
64539
+ document.removeEventListener("pointerup", onPointerUp);
64540
+ document.removeEventListener("pointercancel", onPointerCancel);
64541
+ };
63994
64542
  }
63995
64543
  /************************************************************
63996
64544
  * Find if a canvas point hits a valid hook port during
@@ -64177,6 +64725,7 @@ function start_port_resize(gobj, e) {
64177
64725
  function onPointerUp(ev) {
64178
64726
  document.removeEventListener("pointermove", onPointerMove);
64179
64727
  document.removeEventListener("pointerup", onPointerUp);
64728
+ document.removeEventListener("pointercancel", onPointerCancel);
64180
64729
  const dx = ev.clientX - clientCx;
64181
64730
  const dy = ev.clientY - clientCy;
64182
64731
  let vpR = Math.max(PORT_HANDLE_SIZE, Math.sqrt(dx * dx + dy * dy));
@@ -64199,8 +64748,20 @@ function start_port_resize(gobj, e) {
64199
64748
  mark_graph_dirty(gobj);
64200
64749
  });
64201
64750
  }
64751
+ function onPointerCancel(ev) {
64752
+ document.removeEventListener("pointermove", onPointerMove);
64753
+ document.removeEventListener("pointerup", onPointerUp);
64754
+ document.removeEventListener("pointercancel", onPointerCancel);
64755
+ update_port_resize_handles_position(gobj);
64756
+ }
64202
64757
  document.addEventListener("pointermove", onPointerMove);
64203
64758
  document.addEventListener("pointerup", onPointerUp);
64759
+ document.addEventListener("pointercancel", onPointerCancel);
64760
+ gobj.priv._drag_unwire = function() {
64761
+ document.removeEventListener("pointermove", onPointerMove);
64762
+ document.removeEventListener("pointerup", onPointerUp);
64763
+ document.removeEventListener("pointercancel", onPointerCancel);
64764
+ };
64204
64765
  }
64205
64766
  /************************************************************
64206
64767
  * Edge selection: show a floating properties icon near
@@ -72259,6 +72820,7 @@ var JSON_FIELDS$1 = [
72259
72820
  "properties",
72260
72821
  "pkey2s"
72261
72822
  ];
72823
+ var C_BACKSLASH = "\\\\";
72262
72824
  var JSON_BACKSLASH = "\\\\\\\\";
72263
72825
  var JSON_DQUOTE = "\\\\\\\"";
72264
72826
  var JSON_QUOTE = "\\\\u0027";
@@ -72364,7 +72926,20 @@ function c_scalar(value, key) {
72364
72926
  * themselves.
72365
72927
  ***************************************************************/
72366
72928
  function c_text(text) {
72367
- return text.replace(/\\/g, JSON_BACKSLASH).replace(/"/g, JSON_DQUOTE).replace(/'/g, JSON_QUOTE);
72929
+ return text.replace(/\\/g, JSON_BACKSLASH).replace(/"/g, JSON_DQUOTE).replace(/'/g, JSON_QUOTE).replace(/[\u0000-\u001f\u007f]/g, json_control);
72930
+ }
72931
+ var JSON_SHORT_ESCAPES = {
72932
+ "\n": "n",
72933
+ "\r": "r",
72934
+ " ": "t",
72935
+ "\b": "b",
72936
+ "\f": "f"
72937
+ };
72938
+ function json_control(ch) {
72939
+ if (ch === "\0") return "\\\\ufffd";
72940
+ let short = JSON_SHORT_ESCAPES[ch];
72941
+ if (short) return C_BACKSLASH + short;
72942
+ return "\\\\u" + ch.charCodeAt(0).toString(16).padStart(4, "0");
72368
72943
  }
72369
72944
  /***************************************************************
72370
72945
  * Render a value at `indent`, appending its lines to `lines`.
@@ -74057,7 +74632,7 @@ function render_toolbar(gobj) {
74057
74632
  $trail.push([
74058
74633
  "span",
74059
74634
  { class: "SCHEMA_CRUMB_TREEDB" },
74060
- priv.treedb_id
74635
+ text_node(priv.treedb_id)
74061
74636
  ]);
74062
74637
  }
74063
74638
  if (priv.topic_name) {
@@ -74069,7 +74644,7 @@ function render_toolbar(gobj) {
74069
74644
  $trail.push([
74070
74645
  "span",
74071
74646
  { class: "SCHEMA_CRUMB_TOPIC" },
74072
- priv.topic_name
74647
+ text_node(priv.topic_name)
74073
74648
  ]);
74074
74649
  }
74075
74650
  if (priv.diagram) {
@@ -78685,16 +79260,19 @@ function build_ui(gobj) {
78685
79260
  (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "$container", $container);
78686
79261
  }
78687
79262
  function build_mode_button(gobj, mode) {
79263
+ let name = mode_name(mode);
78688
79264
  let $btn = (0, _yuneta_gobj_js.createElement2)([
78689
79265
  "button",
78690
79266
  {
78691
79267
  class: `button YUI_PERIOD_MODE YUI_PERIOD_MODE_${mode.id.toUpperCase()}`,
78692
- type: "button"
79268
+ type: "button",
79269
+ title: name,
79270
+ "aria-label": name
78693
79271
  },
78694
79272
  [[
78695
79273
  "span",
78696
79274
  { class: "YUI_PERIOD_MODE_TEXT" },
78697
- mode_name(mode)
79275
+ name
78698
79276
  ]]
78699
79277
  ]);
78700
79278
  $btn.addEventListener("click", () => {
@@ -78716,16 +79294,19 @@ function build_more_menu(gobj) {
78716
79294
  ]);
78717
79295
  for (let mode of priv.modes) {
78718
79296
  if (!mode.overflow) continue;
79297
+ let name = mode_name(mode);
78719
79298
  let $item = (0, _yuneta_gobj_js.createElement2)([
78720
79299
  "a",
78721
79300
  {
78722
79301
  class: `dropdown-item YUI_PERIOD_MODE YUI_PERIOD_MODE_${mode.id.toUpperCase()}`,
78723
- href: "#"
79302
+ href: "#",
79303
+ title: name,
79304
+ "aria-label": name
78724
79305
  },
78725
79306
  [[
78726
79307
  "span",
78727
79308
  { class: "YUI_PERIOD_MODE_TEXT" },
78728
- mode_name(mode)
79309
+ name
78729
79310
  ]]
78730
79311
  ]);
78731
79312
  $item.addEventListener("click", (ev) => {
@@ -79023,7 +79604,11 @@ function render_calendar(gobj) {
79023
79604
  "button",
79024
79605
  {
79025
79606
  class: "button is-ghost mt-2 YUI_PERIOD_CAL_TODAY",
79026
- type: "button"
79607
+ type: "button",
79608
+ title: (0, i18next.t)("today"),
79609
+ "data-i18n-title": "today",
79610
+ "aria-label": (0, i18next.t)("today"),
79611
+ "data-i18n-aria-label": "today"
79027
79612
  },
79028
79613
  [[
79029
79614
  "span",
@@ -79351,8 +79936,11 @@ function ac_language_changed(gobj, event, kw, src) {
79351
79936
  let priv = gobj.priv;
79352
79937
  for (let mode of priv.modes) {
79353
79938
  if (!mode.$btn) continue;
79939
+ let name = mode_name(mode);
79354
79940
  let $text = mode.$btn.querySelector(".YUI_PERIOD_MODE_TEXT");
79355
- if ($text) $text.textContent = mode_name(mode);
79941
+ if ($text) $text.textContent = name;
79942
+ mode.$btn.setAttribute("title", name);
79943
+ mode.$btn.setAttribute("aria-label", name);
79356
79944
  }
79357
79945
  repaint(gobj);
79358
79946
  if (priv.$calendar) render_calendar(gobj);
@@ -79902,7 +80490,7 @@ function traffic_scalar_row(key, value) {
79902
80490
  let val_children = [[
79903
80491
  "span",
79904
80492
  { class: "TRAFFIC_VAL " + cls },
79905
- text
80493
+ text_node(text)
79906
80494
  ]];
79907
80495
  if (key in TRAFFIC_TS_FIELDS && typeof value === "number") {
79908
80496
  let iso = traffic_iso(value);
@@ -80035,7 +80623,7 @@ function traffic_value_node(key, value) {
80035
80623
  ]] : object_preview_parts(value, count).map((t) => [
80036
80624
  "span",
80037
80625
  { class: "TRAFFIC_PREV " + t.cls },
80038
- t.text
80626
+ text_node(t.text)
80039
80627
  ]);
80040
80628
  return [
80041
80629
  "details",
@@ -80052,7 +80640,7 @@ function traffic_value_node(key, value) {
80052
80640
  [
80053
80641
  "span",
80054
80642
  { class: "TRAFFIC_NEST_KEY" },
80055
- key
80643
+ text_node(key)
80056
80644
  ],
80057
80645
  [
80058
80646
  "span",
@@ -80087,17 +80675,17 @@ function event_spans(e) {
80087
80675
  ], [
80088
80676
  "span",
80089
80677
  { class: "TRAFFIC_EVENT" },
80090
- e.event
80678
+ text_node(e.event)
80091
80679
  ]];
80092
80680
  if (e.command) spans.push([
80093
80681
  "span",
80094
80682
  { class: "TRAFFIC_CMD" },
80095
- e.command
80683
+ text_node(e.command)
80096
80684
  ]);
80097
80685
  if (e.title) spans.push([
80098
80686
  "span",
80099
80687
  { class: "TRAFFIC_SRC" },
80100
- e.title
80688
+ text_node(e.title)
80101
80689
  ]);
80102
80690
  return spans;
80103
80691
  }
@@ -80177,7 +80765,7 @@ function render_full(e) {
80177
80765
  ], [
80178
80766
  "pre",
80179
80767
  { class: "TRAFFIC_FULL" },
80180
- text
80768
+ document.createTextNode(String(text))
80181
80769
  ]];
80182
80770
  return (0, _yuneta_gobj_js.createElement2)([
80183
80771
  "div",
@@ -80784,7 +81372,9 @@ function build_control_bar() {
80784
81372
  "data-dir": key,
80785
81373
  type: "button",
80786
81374
  title: (0, i18next.t)(title),
80787
- "data-i18n-title": title
81375
+ "data-i18n-title": title,
81376
+ "aria-label": (0, i18next.t)(title),
81377
+ "data-i18n-aria-label": title
80788
81378
  },
80789
81379
  glyph,
80790
81380
  { click: (ev) => {