@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
@@ -1044,6 +1044,7 @@ function mt_stop$20(gobj) {
1044
1044
  st.items = {};
1045
1045
  st.active_route = null;
1046
1046
  }
1047
+ gobj_stop_children(gobj);
1047
1048
  }
1048
1049
  /***************************************************************
1049
1050
  * Framework Method: Destroy
@@ -1836,7 +1837,7 @@ function build_toolbar_action_item(gobj, it) {
1836
1837
  btn_attrs["aria-haspopup"] = "menu";
1837
1838
  btn_attrs["aria-expanded"] = "false";
1838
1839
  }
1839
- let tip = it.tooltip || it.aria_label;
1840
+ let tip = it.tooltip || i18n_aria;
1840
1841
  if (tip) {
1841
1842
  btn_attrs.title = tip;
1842
1843
  btn_attrs["data-i18n-title"] = tip;
@@ -1889,6 +1890,11 @@ function build_toolbar_brand_item(gobj, it) {
1889
1890
  Object.assign(attrs, link);
1890
1891
  } else if (action_type === "") tag = "div";
1891
1892
  else attrs.type = "button";
1893
+ let tip = it.tooltip || i18n_aria;
1894
+ if (tag !== "div" && tip) {
1895
+ attrs.title = tip;
1896
+ attrs["data-i18n-title"] = tip;
1897
+ }
1892
1898
  let $item = createElement2([
1893
1899
  tag,
1894
1900
  attrs,
@@ -1933,7 +1939,7 @@ function build_toolbar_avatar_item(gobj, it) {
1933
1939
  attrs["aria-haspopup"] = "menu";
1934
1940
  attrs["aria-expanded"] = "false";
1935
1941
  }
1936
- let tip = it.tooltip || it.aria_label;
1942
+ let tip = it.tooltip || i18n_aria;
1937
1943
  if (tip) {
1938
1944
  attrs.title = tip;
1939
1945
  attrs["data-i18n-title"] = tip;
@@ -2005,7 +2011,7 @@ function build_toolbar_connection_item(gobj, it) {
2005
2011
  "aria-label": aria_key,
2006
2012
  "data-i18n-aria-label": i18n_aria
2007
2013
  };
2008
- let tip = it.tooltip || it.aria_label;
2014
+ let tip = it.tooltip || i18n_aria;
2009
2015
  if (tip) {
2010
2016
  attrs.title = tip;
2011
2017
  attrs["data-i18n-title"] = tip;
@@ -2138,6 +2144,11 @@ function open_toolbar_dropdown(gobj, item, action, $trigger) {
2138
2144
  $panel.style.right = "auto";
2139
2145
  $panel.style.left = `${Math.round(left)}px`;
2140
2146
  }
2147
+ let max_h = window.innerHeight - Math.max(0, pos.top) - margin;
2148
+ if (max_h > 0) {
2149
+ $panel.style.maxHeight = `${Math.round(max_h)}px`;
2150
+ $panel.style.overflowY = "auto";
2151
+ }
2141
2152
  yui_shell_translate(gobj, $panel);
2142
2153
  let backdrop = (ev) => {
2143
2154
  if ($panel.contains(ev.target)) return;
@@ -2145,7 +2156,10 @@ function open_toolbar_dropdown(gobj, item, action, $trigger) {
2145
2156
  close_toolbar_dropdown(gobj);
2146
2157
  };
2147
2158
  document.addEventListener("mousedown", backdrop, true);
2148
- let dismiss = () => close_toolbar_dropdown(gobj);
2159
+ let dismiss = (ev) => {
2160
+ if (ev && ev.type === "scroll" && ev.target && ev.target !== document && $panel.contains(ev.target)) return;
2161
+ close_toolbar_dropdown(gobj);
2162
+ };
2149
2163
  document.addEventListener("scroll", dismiss, {
2150
2164
  capture: true,
2151
2165
  passive: true
@@ -2244,7 +2258,11 @@ function build_dropdown_row(gobj, sub, idx) {
2244
2258
  "data-dropdown-item-id": sub.id || "",
2245
2259
  "aria-label": aria_key
2246
2260
  };
2247
- if (i18n_aria) attrs["data-i18n-aria-label"] = i18n_aria;
2261
+ if (i18n_aria) {
2262
+ attrs["data-i18n-aria-label"] = i18n_aria;
2263
+ attrs.title = i18n_aria;
2264
+ attrs["data-i18n-title"] = i18n_aria;
2265
+ }
2248
2266
  let $btn = createElement2([
2249
2267
  "button",
2250
2268
  attrs,
@@ -2306,7 +2324,10 @@ function drawers(gobj, menu_id) {
2306
2324
  ************************************************************/
2307
2325
  function push_escape(gobj, layer, handler) {
2308
2326
  let priv = gobj.priv;
2309
- if (!priv || !priv.escape_stack) return;
2327
+ if (!priv || !priv.escape_stack) {
2328
+ log_warning(`C_YUI_SHELL: push_escape('${layer}') on a shell that is gone: Escape will not close it`);
2329
+ return;
2330
+ }
2310
2331
  priv.escape_stack.push({
2311
2332
  layer,
2312
2333
  handler
@@ -2362,9 +2383,11 @@ function pop_escape(gobj, handler) {
2362
2383
  function drain_overlays(gobj) {
2363
2384
  let priv = gobj.priv;
2364
2385
  if (!priv || !priv.overlay_stack) return;
2386
+ let entries = priv.overlay_stack.splice(0);
2365
2387
  let kept = [];
2366
- while (priv.overlay_stack.length > 0) {
2367
- let entry = priv.overlay_stack.pop();
2388
+ while (entries.length > 0) {
2389
+ let entry = entries.pop();
2390
+ if (entry.dismissed) continue;
2368
2391
  if (entry.keep_on_navigate) {
2369
2392
  kept.unshift(entry);
2370
2393
  continue;
@@ -2375,7 +2398,7 @@ function drain_overlays(gobj) {
2375
2398
  log_warning(`C_YUI_SHELL: overlay close on navigation failed: ${e}`);
2376
2399
  }
2377
2400
  }
2378
- for (let entry of kept) priv.overlay_stack.push(entry);
2401
+ priv.overlay_stack.unshift(...kept);
2379
2402
  }
2380
2403
  function retag_overlay_hash(gobj, st, hash) {
2381
2404
  let priv = gobj.priv;
@@ -2405,6 +2428,7 @@ function push_overlay_history(gobj, close, opts) {
2405
2428
  function overlay_dismissed(gobj, entry) {
2406
2429
  let priv = gobj.priv;
2407
2430
  if (!priv || !priv.overlay_stack || !entry) return;
2431
+ entry.dismissed = true;
2408
2432
  let idx = priv.overlay_stack.indexOf(entry);
2409
2433
  if (idx < 0) return;
2410
2434
  priv.overlay_stack.splice(idx, 1);
@@ -2514,7 +2538,10 @@ function update_secondary_nav_visibility(gobj, entry) {
2514
2538
  ************************************************************/
2515
2539
  function ac_nav_clicked(gobj, event, kw, src) {
2516
2540
  let route = kw && kw.route || "";
2517
- if (empty_string(route)) return 0;
2541
+ if (empty_string(route)) {
2542
+ log_warning(`C_YUI_SHELL: ${event} with no route, from ${gobj_short_name(src)}`);
2543
+ return -1;
2544
+ }
2518
2545
  route = remembered_position(gobj, route);
2519
2546
  if (gobj_read_attr(gobj, "use_hash") && !route_restores_url(gobj, route)) {
2520
2547
  let target_hash = route_to_hash(route);
@@ -2552,17 +2579,19 @@ function ac_nav_item_close(gobj, event, kw, src) {
2552
2579
  * FSM
2553
2580
  ***************************************************************/
2554
2581
  /***************************************************************
2555
- * EV_CONNECTION_STATE is an OPTIONAL fact: a view that waits for a
2556
- * backend answer subscribes to it by name. An app that subscribed
2557
- * to EVERY event of its shell with one attr (`subscriber`) did not
2558
- * ask for it and does not declare it -- published to it anyway, the
2559
- * event would be an FSM error in the app on every connection edge,
2560
- * and adding it to the shell a breaking change for every such app.
2561
- * So it reaches only the subscribers that declare it. Every other
2562
- * event of the shell goes out as before.
2582
+ * EV_CONNECTION_STATE and EV_ICONS_CHANGED are OPTIONAL facts: a
2583
+ * view that needs one subscribes to it by name. An app that
2584
+ * subscribed to EVERY event of its shell with one attr
2585
+ * (`subscriber`) did not ask for them and does not declare them --
2586
+ * published to it anyway, each would be an FSM error in the app
2587
+ * every time it fires, and adding one to the shell a breaking
2588
+ * change for every such app (7.26.6 did exactly that with
2589
+ * EV_ICONS_CHANGED). So they reach only the subscribers that
2590
+ * declare them. Every other event of the shell goes out as before.
2563
2591
  ***************************************************************/
2592
+ var OPTIONAL_EVENTS = /* @__PURE__ */ new Set(["EV_CONNECTION_STATE", "EV_ICONS_CHANGED"]);
2564
2593
  function mt_publication_pre_filter(gobj, subs, event, kw) {
2565
- if (event !== "EV_CONNECTION_STATE") return 1;
2594
+ if (!OPTIONAL_EVENTS.has(event)) return 1;
2566
2595
  let subscriber = subs && subs.subscriber;
2567
2596
  if (!subscriber || !gobj_has_event(subscriber, event, 0)) return 0;
2568
2597
  return 1;
@@ -2894,7 +2923,7 @@ function yui_shell_set_translator(shell_gobj, t) {
2894
2923
  *
2895
2924
  * The division of labour, unchanged: LIBRARY-built DOM is
2896
2925
  * translated through here; APP view gclasses translate their own
2897
- * DOM (they own a `t` — see mount_view).
2926
+ * DOM (they own a `t` — see build_view_gobj).
2898
2927
  *
2899
2928
  * Silent no-op with no shell or no translator: an app that never
2900
2929
  * registered one keeps the previous behaviour instead of losing
@@ -2998,6 +3027,35 @@ function yui_shell_close_dropdown(shell_gobj) {
2998
3027
  close_toolbar_dropdown(shell_gobj);
2999
3028
  }
3000
3029
  //#endregion
3030
+ //#region src/yui_text.js
3031
+ /***********************************************************************
3032
+ * yui_text.js
3033
+ *
3034
+ * DATA as text for createElement2().
3035
+ *
3036
+ * createElement2() takes a string content that starts with '<' for
3037
+ * MARKUP and parses it (that is how a component passes an inline
3038
+ * icon). So a value that came from outside -- a backend answer, a
3039
+ * treedb node, a name somebody typed, a frame of the traffic -- must
3040
+ * never go in as a bare string: "<img src=x onerror=...>" would run.
3041
+ * It goes in as a Text node, which is always text.
3042
+ *
3043
+ * Trimmed like createElement2() trims a string, so the change of
3044
+ * form does not change what is shown. A Text node under an
3045
+ * `i18n`/`data-i18n` element is still re-translated by
3046
+ * refresh_language(), which sets textContent.
3047
+ *
3048
+ * Copyright (c) 2026, ArtGins.
3049
+ * All Rights Reserved.
3050
+ ***********************************************************************/
3051
+ /************************************************************
3052
+ * A Text node with `value` as its text ("" for null/undefined).
3053
+ ************************************************************/
3054
+ function text_node(value) {
3055
+ if (value === null || value === void 0) return document.createTextNode("");
3056
+ return document.createTextNode(String(value).trim());
3057
+ }
3058
+ //#endregion
3001
3059
  //#region src/shell_modals.js
3002
3060
  /***********************************************************************
3003
3061
  * shell_modals.js
@@ -3110,7 +3168,7 @@ function show_notification(shell, kind, message, opts) {
3110
3168
  ...p_attrs,
3111
3169
  class: "TOAST_MSG"
3112
3170
  },
3113
- message
3171
+ typeof message === "string" ? text_node(message) : message
3114
3172
  ]]
3115
3173
  ]);
3116
3174
  $layer.appendChild($note);
@@ -3212,7 +3270,7 @@ function yui_shell_show_modal(shell, content, opts) {
3212
3270
  (title_prefix ? [[
3213
3271
  "span",
3214
3272
  { class: "MODAL_TITLE_PREFIX" },
3215
- title_prefix
3273
+ text_node(title_prefix)
3216
3274
  ]] : []).concat(title ? [[
3217
3275
  "span",
3218
3276
  {
@@ -3370,7 +3428,7 @@ function build_dialog(shell, message, buttons, opts) {
3370
3428
  class: "CONFIRM_MSG yui-confirm-msg",
3371
3429
  i18n: message
3372
3430
  },
3373
- message
3431
+ text_node(message)
3374
3432
  ]] : [message];
3375
3433
  let $footer_children = buttons.map((b) => {
3376
3434
  let cls = "CONFIRM_BTN button px-5";
@@ -3571,7 +3629,7 @@ function yui_shell_confirm_yesnocancel(shell, message, opts) {
3571
3629
  *
3572
3630
  * Window - position fixed
3573
3631
  *
3574
- * Copyright (c) 2025, ArtGins.
3632
+ * Copyright (c) 2025-2026, ArtGins.
3575
3633
  * All Rights Reserved.
3576
3634
  ***********************************************************************/
3577
3635
  /***************************************************************
@@ -3613,9 +3671,9 @@ var attrs_table$21 = [
3613
3671
  SDATA(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"),
3614
3672
  SDATA(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"),
3615
3673
  SDATA(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"),
3616
- SDATA(data_type_t.DTP_POINTER, "focus", 0, null, "Brings focus to the element, can be a number or selector"),
3617
- SDATA(data_type_t.DTP_BOOLEAN, "modal", 0, false, "Enable modal mode"),
3618
- SDATA(data_type_t.DTP_BOOLEAN, "keyboard", 0, true, "Close window on ESC if not modal"),
3674
+ SDATA(data_type_t.DTP_POINTER, "focus", 0, null, "NOT implemented yet: would bring focus to the element, a number or a selector"),
3675
+ SDATA(data_type_t.DTP_BOOLEAN, "modal", 0, false, "NOT implemented yet: would enable modal mode"),
3676
+ SDATA(data_type_t.DTP_BOOLEAN, "keyboard", 0, true, "NOT implemented yet: would close the window on ESC (Escape does nothing today)"),
3619
3677
  SDATA(data_type_t.DTP_BOOLEAN, "back_dismissable", 0, true, "Browser Back closes this window (floating overlays only; ignored when it has a `manager`)"),
3620
3678
  SDATA(data_type_t.DTP_BOOLEAN, "keep_on_navigate", 0, false, "This window is a navigation PANEL: a route change does not close it"),
3621
3679
  SDATA(data_type_t.DTP_POINTER, "back_overlay", 0, null, "Internal: overlay-history entry (Back-button integration)"),
@@ -3654,15 +3712,7 @@ function mt_create$21(gobj) {
3654
3712
  title_prefix: gobj_read_str_attr(gobj, "title_prefix") || "",
3655
3713
  icon: gobj_read_attr(gobj, "icon") || ""
3656
3714
  }, gobj);
3657
- } else if (gobj_read_bool_attr(gobj, "back_dismissable")) {
3658
- let shell = yui_shell_of(gobj);
3659
- if (shell) {
3660
- let overlay = yui_shell_register_overlay(shell, function() {
3661
- close_window(gobj);
3662
- }, { keep_on_navigate: gobj_read_bool_attr(gobj, "keep_on_navigate") });
3663
- gobj_write_attr(gobj, "back_overlay", overlay);
3664
- }
3665
- }
3715
+ } else if (gobj_read_bool_attr(gobj, "back_dismissable")) register_back_overlay(gobj);
3666
3716
  let on_win_resize = function() {
3667
3717
  handleResize(gobj);
3668
3718
  };
@@ -3782,7 +3832,7 @@ function build_default_header(gobj) {
3782
3832
  if (!empty_string(prefix)) items.push([
3783
3833
  "span",
3784
3834
  { class: "WINDOW_TITLE_PREFIX has-text-weight-semibold" },
3785
- prefix
3835
+ text_node(prefix)
3786
3836
  ]);
3787
3837
  if (!empty_string(title)) items.push([
3788
3838
  "span",
@@ -3825,7 +3875,9 @@ function resolve_manager(gobj) {
3825
3875
  let m = gobj_read_pointer_attr(gobj, "manager");
3826
3876
  if (!m) return null;
3827
3877
  if (typeof m === "string") {
3828
- m = gobj_find_service(m, false) || null;
3878
+ let name = m;
3879
+ m = gobj_find_service(name, false) || null;
3880
+ if (!m) log_warning(`${GCLASS_NAME$21}: window manager '${name}' not found: no dock, no minimize`);
3829
3881
  gobj_write_attr(gobj, "manager", m);
3830
3882
  }
3831
3883
  return m;
@@ -3935,6 +3987,8 @@ function build_ui$18(gobj) {
3935
3987
  {
3936
3988
  class: "WINDOW_MIN yui-wc wc-min",
3937
3989
  type: "button",
3990
+ title: t("minimize"),
3991
+ "data-i18n-title": "minimize",
3938
3992
  "aria-label": t("minimize"),
3939
3993
  "data-i18n-aria-label": "minimize",
3940
3994
  style: gobj_read_bool_attr(gobj, "showMin") && gobj_read_pointer_attr(gobj, "manager") ? "" : "display:none;"
@@ -3950,6 +4004,8 @@ function build_ui$18(gobj) {
3950
4004
  {
3951
4005
  class: "WINDOW_MAX yui-wc wc-max",
3952
4006
  type: "button",
4007
+ title: t("maximize"),
4008
+ "data-i18n-title": "maximize",
3953
4009
  "aria-label": t("maximize"),
3954
4010
  "data-i18n-aria-label": "maximize",
3955
4011
  style: gobj_read_bool_attr(gobj, "showMax") ? "" : "display:none;"
@@ -3965,13 +4021,15 @@ function build_ui$18(gobj) {
3965
4021
  {
3966
4022
  class: "WINDOW_CLOSE yui-wc wc-close",
3967
4023
  type: "button",
4024
+ title: t("close"),
4025
+ "data-i18n-title": "close",
3968
4026
  "aria-label": t("close"),
3969
4027
  "data-i18n-aria-label": "close"
3970
4028
  },
3971
4029
  WC_CLOSE,
3972
4030
  { click: (evt) => {
3973
4031
  evt.stopPropagation();
3974
- close_window(gobj);
4032
+ gobj_send_event(gobj, "EV_CLOSE_WINDOW", {}, gobj);
3975
4033
  } }
3976
4034
  ]
3977
4035
  ]
@@ -4107,7 +4165,37 @@ function destroy_ui$13(gobj) {
4107
4165
  }
4108
4166
  }
4109
4167
  /************************************************************
4168
+ * Register this floating window in the shell's overlay history,
4169
+ * so the browser Back closes it.
4110
4170
  *
4171
+ * The shell takes the entry off its stack BEFORE it calls the
4172
+ * close function (Back, or a route change draining overlays). When
4173
+ * a subscriber of EV_WINDOW_TO_CLOSE vetoes the close, the window
4174
+ * stays up with no entry: Back would no longer close it, and it
4175
+ * would float over the next views. So a window that survives its
4176
+ * own close function registers again.
4177
+ ************************************************************/
4178
+ function register_back_overlay(gobj) {
4179
+ let shell = yui_shell_of(gobj);
4180
+ if (!shell) return;
4181
+ const rearm = function() {
4182
+ if (!gobj_is_destroying(gobj) && !gobj_read_attr(gobj, "back_overlay")) register_back_overlay(gobj);
4183
+ };
4184
+ let overlay = yui_shell_register_overlay(shell, function() {
4185
+ gobj_write_attr(gobj, "back_overlay", null);
4186
+ const closing = close_window(gobj);
4187
+ if (closing.state === "vetoed") rearm();
4188
+ else if (closing.state === "asking") closing.answer.then(rearm);
4189
+ }, { keep_on_navigate: gobj_read_bool_attr(gobj, "keep_on_navigate") });
4190
+ gobj_write_attr(gobj, "back_overlay", overlay);
4191
+ }
4192
+ /************************************************************
4193
+ * Ask to close the window. Answers what happened:
4194
+ * {state: "closed"} the window is destroyed
4195
+ * {state: "vetoed"} a subscriber kept it open
4196
+ * {state: "asking", answer} a subscriber asked a question
4197
+ * first; `answer` resolves to
4198
+ * it once it is over
4111
4199
  ************************************************************/
4112
4200
  function close_window(gobj) {
4113
4201
  let kw_close = { abort_close: false };
@@ -4118,19 +4206,26 @@ function close_window(gobj) {
4118
4206
  if (gobj_is_running(gobj)) gobj_stop(gobj);
4119
4207
  gobj_stop_children(gobj);
4120
4208
  gobj_destroy(gobj);
4121
- } else if (kw_close.warning) yui_shell_confirm_yesnocancel(yui_shell_of(gobj), kw_close.warning, {
4122
- t,
4123
- yes_label: "yes",
4124
- no_label: "no",
4125
- cancel_label: "cancel"
4126
- }).then(function(answer) {
4127
- if (answer === "yes") {
4209
+ return { state: "closed" };
4210
+ }
4211
+ if (!kw_close.warning) return { state: "vetoed" };
4212
+ return {
4213
+ state: "asking",
4214
+ answer: yui_shell_confirm_yesnocancel(yui_shell_of(gobj), kw_close.warning, {
4215
+ t,
4216
+ yes_label: "yes",
4217
+ no_label: "no",
4218
+ cancel_label: "cancel"
4219
+ }).then(function(answer) {
4220
+ if (answer !== "yes") return answer;
4221
+ if (gobj_is_destroying(gobj)) return answer;
4128
4222
  if (on_close) on_close();
4129
- gobj_stop(gobj);
4223
+ if (gobj_is_running(gobj)) gobj_stop(gobj);
4130
4224
  gobj_stop_children(gobj);
4131
4225
  gobj_destroy(gobj);
4132
- }
4133
- });
4226
+ return answer;
4227
+ })
4228
+ };
4134
4229
  }
4135
4230
  /************************************************************
4136
4231
  *
@@ -4164,8 +4259,12 @@ function set_max_icon(gobj, maximized) {
4164
4259
  if (!$container) return;
4165
4260
  let $btn = $container.querySelector(".wc-max");
4166
4261
  if ($btn) {
4262
+ let key = maximized ? "restore" : "maximize";
4167
4263
  $btn.innerHTML = maximized ? WC_RESTORE : WC_MAX;
4168
- $btn.setAttribute("aria-label", maximized ? "restore" : "maximize");
4264
+ $btn.setAttribute("title", t(key));
4265
+ $btn.setAttribute("data-i18n-title", key);
4266
+ $btn.setAttribute("aria-label", t(key));
4267
+ $btn.setAttribute("data-i18n-aria-label", key);
4169
4268
  }
4170
4269
  }
4171
4270
  /************************************************************
@@ -4387,6 +4486,19 @@ function ac_refresh$11(gobj, event, kw, src) {
4387
4486
  *
4388
4487
  ************************************************************/
4389
4488
  function ac_show$15(gobj, event, kw, src) {
4489
+ let manager = gobj_read_pointer_attr(gobj, "manager");
4490
+ if (manager) {
4491
+ gobj_send_event(manager, "EV_FOCUS_WINDOW", { window: gobj }, gobj);
4492
+ return 0;
4493
+ }
4494
+ let $container = gobj_read_attr(gobj, "$container");
4495
+ if (!$container) {
4496
+ log_error(`${gobj_short_name(gobj)}: EV_SHOW without a container`);
4497
+ return -1;
4498
+ }
4499
+ $container.style.removeProperty("display");
4500
+ let $parent = $container.parentNode;
4501
+ if ($parent && $parent.lastChild !== $container) $parent.appendChild($container);
4390
4502
  return 0;
4391
4503
  }
4392
4504
  /************************************************************
@@ -4808,7 +4920,7 @@ function ac_register_window(gobj, event, kw, src) {
4808
4920
  if (prefix) label_items.push([
4809
4921
  "span",
4810
4922
  { class: "yui-dock-label-prefix" },
4811
- prefix
4923
+ text_node(prefix)
4812
4924
  ]);
4813
4925
  if (title_key) label_items.push([
4814
4926
  "span",
@@ -4821,7 +4933,7 @@ function ac_register_window(gobj, event, kw, src) {
4821
4933
  if (label_items.length === 0) label_items.push([
4822
4934
  "span",
4823
4935
  { class: "yui-dock-label-kind" },
4824
- title
4936
+ text_node(title)
4825
4937
  ]);
4826
4938
  let entry = {
4827
4939
  gobj: win,
@@ -4848,6 +4960,8 @@ function ac_register_window(gobj, event, kw, src) {
4848
4960
  {
4849
4961
  class: "yui-dock-close",
4850
4962
  type: "button",
4963
+ title: t("close"),
4964
+ "data-i18n-title": "close",
4851
4965
  "aria-label": t("close"),
4852
4966
  "data-i18n-aria-label": "close"
4853
4967
  },
@@ -5112,6 +5226,8 @@ function build_ui$17(gobj) {
5112
5226
  "button",
5113
5227
  {
5114
5228
  class: "yui-pager-back button is-white is-hidden",
5229
+ title: t("back"),
5230
+ "data-i18n-title": "back",
5115
5231
  "aria-label": t("back"),
5116
5232
  "data-i18n-aria-label": "back"
5117
5233
  },
@@ -5137,6 +5253,8 @@ function build_ui$17(gobj) {
5137
5253
  "button",
5138
5254
  {
5139
5255
  class: "yui-pager-discard button is-white is-hidden",
5256
+ title: t("discard"),
5257
+ "data-i18n-title": "discard",
5140
5258
  "aria-label": t("discard"),
5141
5259
  "data-i18n-aria-label": "discard"
5142
5260
  },
@@ -5217,13 +5335,12 @@ function render_header(gobj) {
5217
5335
  let $discard = $container.querySelector(".yui-pager-discard");
5218
5336
  $back.classList.toggle("is-hidden", !model.show_back);
5219
5337
  let $back_icon = $back.querySelector("i");
5220
- if (model.back_kind === "close") {
5221
- $back_icon.className = "yi-xmark";
5222
- $back.setAttribute("aria-label", "close");
5223
- } else {
5224
- $back_icon.className = "yi-arrow-left";
5225
- $back.setAttribute("aria-label", "back");
5226
- }
5338
+ let back_key = model.back_kind === "close" ? "close" : "back";
5339
+ $back_icon.className = back_key === "close" ? "yi-xmark" : "yi-arrow-left";
5340
+ $back.setAttribute("title", t(back_key));
5341
+ $back.setAttribute("data-i18n-title", back_key);
5342
+ $back.setAttribute("aria-label", t(back_key));
5343
+ $back.setAttribute("data-i18n-aria-label", back_key);
5227
5344
  $discard.classList.toggle("is-hidden", !model.show_discard);
5228
5345
  $title.setAttribute("data-i18n", model.title);
5229
5346
  $title.textContent = t(model.title);
@@ -5631,6 +5748,8 @@ function mt_destroy$18(gobj) {
5631
5748
  * Build UI
5632
5749
  ************************************************************/
5633
5750
  function build_ui$16(gobj) {
5751
+ let back_label = gobj_read_attr(gobj, "back_label");
5752
+ let next_label = gobj_read_attr(gobj, "next_label");
5634
5753
  let $container = createElement2([
5635
5754
  "div",
5636
5755
  {
@@ -5678,8 +5797,10 @@ function build_ui$16(gobj) {
5678
5797
  "button",
5679
5798
  {
5680
5799
  class: "yui-wizard-back button",
5681
- "aria-label": t("back"),
5682
- "data-i18n-aria-label": "back"
5800
+ title: t(back_label),
5801
+ "data-i18n-title": back_label,
5802
+ "aria-label": t(back_label),
5803
+ "data-i18n-aria-label": back_label
5683
5804
  },
5684
5805
  [[
5685
5806
  "span",
@@ -5689,9 +5810,9 @@ function build_ui$16(gobj) {
5689
5810
  "span",
5690
5811
  {
5691
5812
  class: "is-hidden-mobile",
5692
- i18n: "back"
5813
+ i18n: back_label
5693
5814
  },
5694
- "back"
5815
+ back_label
5695
5816
  ]],
5696
5817
  { click: function(evt) {
5697
5818
  evt.stopPropagation();
@@ -5701,16 +5822,18 @@ function build_ui$16(gobj) {
5701
5822
  "button",
5702
5823
  {
5703
5824
  class: "yui-wizard-primary button is-link",
5704
- "aria-label": t("next"),
5705
- "data-i18n-aria-label": "next"
5825
+ title: t(next_label),
5826
+ "data-i18n-title": next_label,
5827
+ "aria-label": t(next_label),
5828
+ "data-i18n-aria-label": next_label
5706
5829
  },
5707
5830
  [[
5708
5831
  "span",
5709
5832
  {
5710
5833
  class: "yui-wizard-primary-label",
5711
- i18n: "next"
5834
+ i18n: next_label
5712
5835
  },
5713
- "next"
5836
+ next_label
5714
5837
  ]],
5715
5838
  { click: function(evt) {
5716
5839
  evt.stopPropagation();
@@ -5769,14 +5892,19 @@ function render_chrome(gobj) {
5769
5892
  let $title = $container.querySelector(".yui-wizard-title");
5770
5893
  let $counter = $container.querySelector(".yui-wizard-counter");
5771
5894
  let $back = $container.querySelector(".yui-wizard-back");
5895
+ let $primary = $container.querySelector(".yui-wizard-primary");
5772
5896
  let $plabel = $container.querySelector(".yui-wizard-primary-label");
5773
- $title.setAttribute("i18n", model.title);
5774
- $title.textContent = model.title;
5897
+ $title.setAttribute("data-i18n", model.title);
5898
+ $title.textContent = t(model.title);
5775
5899
  if (model.count > 0) $counter.textContent = `${model.idx + 1} / ${model.count}`;
5776
5900
  else $counter.textContent = "";
5777
5901
  $back.classList.toggle("is-hidden", !model.show_back);
5778
- $plabel.setAttribute("i18n", model.primary_label);
5779
- $plabel.textContent = model.primary_label;
5902
+ $plabel.setAttribute("data-i18n", model.primary_label);
5903
+ $plabel.textContent = t(model.primary_label);
5904
+ $primary.setAttribute("title", t(model.primary_label));
5905
+ $primary.setAttribute("data-i18n-title", model.primary_label);
5906
+ $primary.setAttribute("aria-label", t(model.primary_label));
5907
+ $primary.setAttribute("data-i18n-aria-label", model.primary_label);
5780
5908
  for (let i = 0; i < priv.steps.length; i++) {
5781
5909
  let s = priv.steps[i];
5782
5910
  if (s.$el) s.$el.classList.toggle("is-hidden", i !== model.idx);
@@ -7990,6 +8118,112 @@ function datetime_local_to_epoch(value) {
7990
8118
  return Math.floor(date.getTime() / 1e3);
7991
8119
  }
7992
8120
  //#endregion
8121
+ //#region src/form_json_field.js
8122
+ /***********************************************************************
8123
+ * form_json_field.js
8124
+ *
8125
+ * Pure logic of a json field of C_YUI_FORM: what a jsoneditor
8126
+ * holds, read as the value its column stores.
8127
+ *
8128
+ * The editor answers its content in one of two shapes -- {json}
8129
+ * (tree mode) or {text} (text mode, whatever the reader typed).
8130
+ * A text that does not parse used to be caught and replaced by
8131
+ * `{}` or `[]`, and SAVED: a trailing comma wiped the column, with
8132
+ * no log and no message. A text that is not json, or json of the
8133
+ * wrong shape (a list in a dict column), is an error now, and the
8134
+ * form refuses to save while a field holds one.
8135
+ *
8136
+ * Copyright (c) 2026, ArtGins.
8137
+ * All Rights Reserved.
8138
+ ***********************************************************************/
8139
+ var SHAPE_OF_TYPE = {
8140
+ object: "dict",
8141
+ dict: "dict",
8142
+ template: "dict",
8143
+ array: "list",
8144
+ list: "list",
8145
+ table: "list",
8146
+ coordinates: "container"
8147
+ };
8148
+ /************************************************************
8149
+ * The shape `type` stores: "dict", "list", "container" or "any".
8150
+ ************************************************************/
8151
+ function json_field_shape(type) {
8152
+ return SHAPE_OF_TYPE[type] || "any";
8153
+ }
8154
+ /************************************************************
8155
+ * The empty value of a shape: what a blank editor stores.
8156
+ ************************************************************/
8157
+ function json_field_empty(shape) {
8158
+ if (shape === "list") return [];
8159
+ return {};
8160
+ }
8161
+ function value_fits(value, shape) {
8162
+ let is_list = Array.isArray(value);
8163
+ let is_dict = value !== null && typeof value === "object" && !is_list;
8164
+ switch (shape) {
8165
+ case "dict": return is_dict;
8166
+ case "list": return is_list;
8167
+ case "container": return is_dict || is_list;
8168
+ default: return true;
8169
+ }
8170
+ }
8171
+ /************************************************************
8172
+ * Parse what a json field holds.
8173
+ *
8174
+ * `value` is a json string (what the form reads out of an editor)
8175
+ * or an already parsed value; an editor's content goes through
8176
+ * json_editor_value() first.
8177
+ * Returns {value, error}: `error` is "" when the value is good, else
8178
+ * an i18n key; `value` is then the empty value of the shape and must
8179
+ * NOT be stored.
8180
+ *
8181
+ * A blank text is not an error: it is the empty value.
8182
+ ************************************************************/
8183
+ function parse_json_field(value, type) {
8184
+ let shape = json_field_shape(type);
8185
+ if (typeof value === "string") {
8186
+ if (value.trim() === "") return {
8187
+ value: json_field_empty(shape),
8188
+ error: ""
8189
+ };
8190
+ try {
8191
+ value = JSON.parse(value);
8192
+ } catch (e) {
8193
+ return {
8194
+ value: json_field_empty(shape),
8195
+ error: "invalid json"
8196
+ };
8197
+ }
8198
+ }
8199
+ if (value === void 0) return {
8200
+ value: json_field_empty(shape),
8201
+ error: ""
8202
+ };
8203
+ if (!value_fits(value, shape)) return {
8204
+ value: json_field_empty(shape),
8205
+ error: "invalid json"
8206
+ };
8207
+ return {
8208
+ value,
8209
+ error: ""
8210
+ };
8211
+ }
8212
+ /************************************************************
8213
+ * What a jsoneditor content ({text} or {json}) holds, as TEXT:
8214
+ * the text as typed, or the tree-mode json serialized -- which is
8215
+ * what get_form_values() reads out of the editor too. Handing the
8216
+ * tree-mode value back as is made parse_json_field() parse a
8217
+ * string ROOT a second time: "123" was checked as the number 123,
8218
+ * and "abc" as a text that is no json.
8219
+ ************************************************************/
8220
+ function json_editor_value(content) {
8221
+ if (!content) return;
8222
+ if (content.text !== void 0) return content.text;
8223
+ if (content.json === void 0) return;
8224
+ return JSON.stringify(content.json);
8225
+ }
8226
+ //#endregion
7993
8227
  //#region src/c_yui_form.js
7994
8228
  /***********************************************************************
7995
8229
  * c_yui_form.js
@@ -8036,7 +8270,11 @@ var attrs_table$17 = [
8036
8270
  SDATA(data_type_t.DTP_BOOLEAN, "changes", 0, false, "Indicates if changes have been made"),
8037
8271
  SDATA_END()
8038
8272
  ];
8039
- var PRIVATE_DATA$17 = {};
8273
+ var PRIVATE_DATA$17 = {
8274
+ rearm_timer: null,
8275
+ tables: null,
8276
+ table_seq: 0
8277
+ };
8040
8278
  var __gclass__$17 = null;
8041
8279
  /***************************
8042
8280
  * Framework Methods
@@ -8050,6 +8288,7 @@ function mt_create$17(gobj) {
8050
8288
  gobj_subscribe_event(gobj, null, {}, subscriber);
8051
8289
  let name = clean_name(gobj_name(gobj));
8052
8290
  gobj_write_attr(gobj, "form_id", "form" + name);
8291
+ gobj.priv.tables = /* @__PURE__ */ new Map();
8053
8292
  build_ui$15(gobj);
8054
8293
  }
8055
8294
  /************************************************************
@@ -8103,26 +8342,30 @@ function set_changed_stated(gobj, changed) {
8103
8342
  enable($button_save, true, "MediumSeaGreen");
8104
8343
  enable($button_undo, true, "Magenta");
8105
8344
  $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
8106
- if (isEventSet($table.tabulator, "dataChanged")) $table.tabulator.off("dataChanged");
8345
+ if ($table.tabulator && isEventSet($table.tabulator, "dataChanged")) $table.tabulator.off("dataChanged");
8107
8346
  $table.querySelectorAll(".yui-tabulator-table-nested").forEach(($table_nested) => {
8108
- if (isEventSet($table_nested.tabulator, "dataChanged")) $table_nested.tabulator.off("dataChanged");
8347
+ if ($table_nested.tabulator && isEventSet($table_nested.tabulator, "dataChanged")) $table_nested.tabulator.off("dataChanged");
8109
8348
  });
8110
8349
  });
8111
8350
  } else {
8112
8351
  gobj_write_bool_attr(gobj, "changes", false);
8113
8352
  enable($button_save, false, OFF_COLOR);
8114
8353
  enable($button_undo, false, OFF_COLOR);
8115
- setTimeout(function() {
8116
- $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
8117
- if (isEventSet($table.tabulator, "dataChanged")) $table.tabulator.off("dataChanged");
8118
- $table.tabulator.on("dataChanged", function(data) {
8354
+ if (gobj.priv.rearm_timer) clearTimeout(gobj.priv.rearm_timer);
8355
+ gobj.priv.rearm_timer = setTimeout(function() {
8356
+ gobj.priv.rearm_timer = null;
8357
+ if (gobj_is_destroying(gobj)) return;
8358
+ const rearm = (tabulator) => {
8359
+ if (!tabulator) return;
8360
+ if (isEventSet(tabulator, "dataChanged")) tabulator.off("dataChanged");
8361
+ tabulator.on("dataChanged", function(data) {
8119
8362
  gobj_send_event(gobj, "EV_RECORD_CHANGED", {}, gobj);
8120
8363
  });
8364
+ };
8365
+ $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
8366
+ rearm($table.tabulator);
8121
8367
  $table.querySelectorAll(".yui-tabulator-table-nested").forEach(($table_nested) => {
8122
- if (isEventSet($table_nested.tabulator, "dataChanged")) $table_nested.tabulator.off("dataChanged");
8123
- $table_nested.tabulator.on("dataChanged", function(data) {
8124
- gobj_send_event(gobj, "EV_RECORD_CHANGED", {}, gobj);
8125
- });
8368
+ rearm($table_nested.tabulator);
8126
8369
  });
8127
8370
  });
8128
8371
  }, 200);
@@ -8352,12 +8595,110 @@ function build_ui$15(gobj) {
8352
8595
  * Destroy UI
8353
8596
  ************************************************************/
8354
8597
  function destroy_ui$10(gobj) {
8598
+ if (gobj.priv && gobj.priv.rearm_timer) {
8599
+ clearTimeout(gobj.priv.rearm_timer);
8600
+ gobj.priv.rearm_timer = null;
8601
+ }
8355
8602
  let $container = gobj_read_attr(gobj, "$container");
8356
8603
  if ($container) {
8604
+ destroy_widgets(gobj, $container);
8357
8605
  if ($container.parentNode) $container.parentNode.removeChild($container);
8358
8606
  gobj_write_attr(gobj, "$container", null);
8359
8607
  }
8360
8608
  }
8609
+ /************************************************************
8610
+ * The icon a table cell draws as its control (delete the row,
8611
+ * add a nested row): an element, so it carries its name. Drawn
8612
+ * by Tabulator on every render, so t() at render time is
8613
+ * current.
8614
+ ************************************************************/
8615
+ function cell_icon(icon_class, key) {
8616
+ let $i = document.createElement("i");
8617
+ $i.className = icon_class;
8618
+ $i.setAttribute("role", "button");
8619
+ $i.setAttribute("tabindex", "0");
8620
+ $i.setAttribute("title", t(key));
8621
+ $i.setAttribute("data-i18n-title", key);
8622
+ $i.setAttribute("aria-label", t(key));
8623
+ $i.setAttribute("data-i18n-aria-label", key);
8624
+ $i.addEventListener("keydown", function(evt) {
8625
+ if (evt.key === "Enter" || evt.key === " ") {
8626
+ evt.preventDefault();
8627
+ $i.click();
8628
+ }
8629
+ });
8630
+ return $i;
8631
+ }
8632
+ /************************************************************
8633
+ * The identity of a table element, for the kw of
8634
+ * EV_ADD_TABLE_ROW: a kw is plain json, and an element (with its
8635
+ * `.tabulator`, circular) broke the `machine` trace that dumps it.
8636
+ * Given on first use and kept on the element; the registry holds
8637
+ * it weakly, so a nested table re-built by its row formatter is
8638
+ * not kept alive by it.
8639
+ ************************************************************/
8640
+ function table_identity(gobj, $table) {
8641
+ if (!$table.yui_table_id) {
8642
+ let priv = gobj.priv;
8643
+ priv.table_seq += 1;
8644
+ $table.yui_table_id = `t${priv.table_seq}`;
8645
+ priv.tables.set($table.yui_table_id, new WeakRef($table));
8646
+ }
8647
+ return $table.yui_table_id;
8648
+ }
8649
+ /************************************************************
8650
+ * The element of a table identity, or null when it is gone.
8651
+ ************************************************************/
8652
+ function find_table(gobj, table_id) {
8653
+ let priv = gobj.priv;
8654
+ let ref = priv.tables ? priv.tables.get(table_id) : null;
8655
+ let $table = ref ? ref.deref() : null;
8656
+ if (!$table) {
8657
+ if (priv.tables) priv.tables.delete(table_id);
8658
+ return null;
8659
+ }
8660
+ return $table;
8661
+ }
8662
+ /************************************************************
8663
+ * Destroy the third-party widgets the form built. Removing
8664
+ * their DOM is not enough: Tom Select keeps listeners on
8665
+ * `document` and `window`, the jsoneditor is a live Svelte app
8666
+ * and a Tabulator keeps its observers -- each one a closure over
8667
+ * this form, alive for the life of the page. Nested tables go
8668
+ * first: their parent's destroy drops the rows they hang from.
8669
+ ************************************************************/
8670
+ function destroy_widgets(gobj, $container) {
8671
+ let destroy = (what, widget) => {
8672
+ try {
8673
+ let r = widget.destroy();
8674
+ if (r && typeof r.then === "function") r.catch((e) => {
8675
+ log_warning(`${gobj_short_name(gobj)}: cannot destroy ${what}: ${e}`);
8676
+ });
8677
+ } catch (e) {
8678
+ log_warning(`${gobj_short_name(gobj)}: cannot destroy ${what}: ${e}`);
8679
+ }
8680
+ };
8681
+ $container.querySelectorAll(".yui-tabulator-table-nested").forEach(($el) => {
8682
+ if ($el.tabulator) {
8683
+ destroy("nested table", $el.tabulator);
8684
+ $el.tabulator = null;
8685
+ }
8686
+ });
8687
+ $container.querySelectorAll(".yui-form-data-input").forEach(($el) => {
8688
+ if ($el.tom_select) {
8689
+ destroy("select", $el.tom_select);
8690
+ $el.tom_select = null;
8691
+ }
8692
+ if ($el.jsoneditor) {
8693
+ destroy("json editor", $el.jsoneditor);
8694
+ $el.jsoneditor = null;
8695
+ }
8696
+ if ($el.tabulator) {
8697
+ destroy("table", $el.tabulator);
8698
+ $el.tabulator = null;
8699
+ }
8700
+ });
8701
+ }
8361
8702
  /******************************************************************
8362
8703
  * Build form with bulma and createElement2
8363
8704
  ******************************************************************/
@@ -8390,6 +8731,15 @@ function name_form_control($field, conf) {
8390
8731
  $ts.setAttribute("aria-label", t(key));
8391
8732
  $ts.setAttribute("data-i18n-aria-label", key);
8392
8733
  }
8734
+ let $clear = $field.querySelector(".ts-wrapper .clear-button");
8735
+ if ($clear) {
8736
+ const CLEAR_KEY = "remove all selected options";
8737
+ $clear.setAttribute("role", "button");
8738
+ $clear.setAttribute("title", t(CLEAR_KEY));
8739
+ $clear.setAttribute("data-i18n-title", CLEAR_KEY);
8740
+ $clear.setAttribute("aria-label", t(CLEAR_KEY));
8741
+ $clear.setAttribute("data-i18n-aria-label", CLEAR_KEY);
8742
+ }
8393
8743
  }
8394
8744
  function build_form(gobj) {
8395
8745
  let form_id = gobj_read_str_attr(gobj, "form_id");
@@ -8740,12 +9090,7 @@ function apply_form_mode(gobj, $form) {
8740
9090
  ******************************************************************/
8741
9091
  function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, name, label, label_i18n, placeholder, options, extras, readonly, required, hidden, default_value }) {
8742
9092
  let $element;
8743
- let kw_add_table_row = {
8744
- $row: null,
8745
- $table: null,
8746
- record: {},
8747
- loading: false
8748
- };
9093
+ let $add_table = null;
8749
9094
  switch (tag) {
8750
9095
  case "input":
8751
9096
  switch (inputType) {
@@ -8763,7 +9108,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8763
9108
  i18n: label_i18n || label,
8764
9109
  for: name
8765
9110
  },
8766
- label
9111
+ text_node(label)
8767
9112
  ]]
8768
9113
  ], [
8769
9114
  "div",
@@ -8796,7 +9141,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8796
9141
  i18n: label_i18n || label,
8797
9142
  for: name
8798
9143
  },
8799
- label
9144
+ text_node(label)
8800
9145
  ]]
8801
9146
  ], [
8802
9147
  "div",
@@ -8837,7 +9182,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8837
9182
  i18n: label_i18n || label,
8838
9183
  for: name
8839
9184
  },
8840
- label
9185
+ text_node(label)
8841
9186
  ]]
8842
9187
  ], [
8843
9188
  "div",
@@ -8868,7 +9213,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8868
9213
  i18n: label_i18n || label,
8869
9214
  for: name
8870
9215
  },
8871
- label
9216
+ text_node(label)
8872
9217
  ]]
8873
9218
  ], [
8874
9219
  "div",
@@ -8898,7 +9243,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8898
9243
  class: "label",
8899
9244
  i18n: label_i18n || label
8900
9245
  },
8901
- label
9246
+ text_node(label)
8902
9247
  ]]
8903
9248
  ], [
8904
9249
  "div",
@@ -8911,7 +9256,13 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8911
9256
  { class: "" },
8912
9257
  [[
8913
9258
  "button",
8914
- { class: "button p-1" },
9259
+ {
9260
+ class: "button p-1",
9261
+ title: t("add"),
9262
+ "data-i18n-title": "add",
9263
+ "aria-label": t("add"),
9264
+ "data-i18n-aria-label": "add"
9265
+ },
8915
9266
  [[
8916
9267
  "span",
8917
9268
  { class: "icon m-0" },
@@ -8927,7 +9278,15 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8927
9278
  { click: function(evt) {
8928
9279
  evt.stopPropagation();
8929
9280
  evt.preventDefault();
8930
- gobj_send_event(gobj, "EV_ADD_TABLE_ROW", kw_add_table_row, gobj);
9281
+ if (!$add_table) {
9282
+ log_error(`${gobj_short_name(gobj)}: "add" of a field without a table`);
9283
+ return;
9284
+ }
9285
+ gobj_send_event(gobj, "EV_ADD_TABLE_ROW", {
9286
+ table_id: table_identity(gobj, $add_table),
9287
+ record: {},
9288
+ loading: false
9289
+ }, gobj);
8931
9290
  } }
8932
9291
  ]]
8933
9292
  ]]
@@ -8983,7 +9342,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8983
9342
  i18n: label_i18n || label,
8984
9343
  for: name
8985
9344
  },
8986
- label
9345
+ text_node(label)
8987
9346
  ]]
8988
9347
  ], [
8989
9348
  "div",
@@ -9069,7 +9428,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9069
9428
  value: option,
9070
9429
  i18n: option
9071
9430
  },
9072
- option
9431
+ text_node(option)
9073
9432
  ]),
9074
9433
  { "change": function(evt) {
9075
9434
  gobj_send_event(gobj, "EV_RECORD_CHANGED", {}, gobj);
@@ -9098,14 +9457,14 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9098
9457
  opts.map((option) => is_icon ? [
9099
9458
  "option",
9100
9459
  { value: option },
9101
- option
9460
+ text_node(option)
9102
9461
  ] : [
9103
9462
  "option",
9104
9463
  {
9105
9464
  value: option,
9106
9465
  i18n: option
9107
9466
  },
9108
- option
9467
+ text_node(option)
9109
9468
  ])
9110
9469
  ];
9111
9470
  $extend = createElement2(extend);
@@ -9148,13 +9507,19 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9148
9507
  break;
9149
9508
  }
9150
9509
  case "radio": {
9151
- let elm = `
9152
- <label class="radio">
9153
- <input type="radio" name="${name}">
9154
- ${t(options)}
9155
- </label>
9156
- `;
9157
- $extend = createOneHtml(elm);
9510
+ let label_key = String(options === void 0 || options === null ? "" : options);
9511
+ $extend = createElement2([
9512
+ "label",
9513
+ { class: "radio" },
9514
+ [["input", {
9515
+ type: "radio",
9516
+ name
9517
+ }], [
9518
+ "span",
9519
+ { i18n: label_key },
9520
+ text_node(label_key)
9521
+ ]]
9522
+ ]);
9158
9523
  $control.appendChild($extend);
9159
9524
  break;
9160
9525
  }
@@ -9174,6 +9539,10 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9174
9539
  props: {
9175
9540
  readOnly: !!readonly,
9176
9541
  onChange: function() {
9542
+ if ($extend.yui_json_error) {
9543
+ check_json_editor($extend);
9544
+ mark_field_validity($extend);
9545
+ }
9177
9546
  gobj_send_event(gobj, "EV_RECORD_CHANGED", {}, gobj);
9178
9547
  },
9179
9548
  timestampTag: function({ field, value, path }) {
@@ -9200,7 +9569,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9200
9569
  }]);
9201
9570
  $control.appendChild($extend);
9202
9571
  $extend.tabulator = create_tabulator$1(gobj, $extend, name, options);
9203
- kw_add_table_row["$table"] = $extend;
9572
+ $add_table = $extend;
9204
9573
  break;
9205
9574
  case "coordinates": {
9206
9575
  let attrs = {
@@ -9497,7 +9866,7 @@ function create_tabulator$1(gobj, $extend, name, template) {
9497
9866
  };
9498
9867
  if (gobj_read_bool_attr(gobj, "with_delete_row_btn")) columns.push({
9499
9868
  formatter: function(cell, formatterParams) {
9500
- return "<i style=\"\" class=\"yi-trash has-text-danger\"></i>";
9869
+ return cell_icon("yi-trash has-text-danger", "delete");
9501
9870
  },
9502
9871
  width: 40,
9503
9872
  hozAlign: "center",
@@ -9578,16 +9947,18 @@ function template2columns(gobj, columns, template, sub_elements) {
9578
9947
  });
9579
9948
  Object.assign(column, {
9580
9949
  formatter: function(cell, formatterParams) {
9581
- return "<i style=\"\" class=\"yi-plus has-text-link\"></i>";
9950
+ return cell_icon("yi-plus has-text-link", "add");
9582
9951
  },
9583
9952
  hozAlign: "center",
9584
9953
  cellClick: function(evt, cell) {
9585
9954
  evt.stopPropagation();
9586
- let $row = cell.getRow().getElement();
9587
- let $extend = $row.querySelector(`[name="${field_desc.name}"]`);
9955
+ let $extend = cell.getRow().getElement().querySelector(`[name="${field_desc.name}"]`);
9956
+ if (!$extend) {
9957
+ log_error(`${gobj_short_name(gobj)}: nested table '${field_desc.name}' not found in its row`);
9958
+ return;
9959
+ }
9588
9960
  gobj_send_event(gobj, "EV_ADD_TABLE_ROW", {
9589
- $row,
9590
- $table: $extend,
9961
+ table_id: table_identity(gobj, $extend),
9591
9962
  record: {},
9592
9963
  loading: false
9593
9964
  }, gobj);
@@ -9720,11 +10091,22 @@ function template2columns(gobj, columns, template, sub_elements) {
9720
10091
  * out-of-range number is more precise than anything generic here.
9721
10092
  ************************************************************/
9722
10093
  function field_validation_message($input) {
9723
- let v = $input.validity;
9724
- if (v && v.valueMissing) return t("this field is required");
10094
+ let key = field_validation_key($input);
10095
+ if (key) return t(key);
9725
10096
  return $input.validationMessage;
9726
10097
  }
9727
10098
  /************************************************************
10099
+ * The i18n key of the message, when the message is ours ("" when
10100
+ * it is the browser's): written as the help line's data-i18n, so
10101
+ * a language change re-translates the line on screen.
10102
+ ************************************************************/
10103
+ function field_validation_key($input) {
10104
+ if ($input.yui_json_error) return $input.yui_json_error;
10105
+ let v = $input.validity;
10106
+ if (v && v.valueMissing) return "this field is required";
10107
+ return "";
10108
+ }
10109
+ /************************************************************
9728
10110
  * Mark a field as wrong, or clear the mark. One place: the same
9729
10111
  * three lines lived in the `invalid` and `blur` handlers of every
9730
10112
  * field kind.
@@ -9732,16 +10114,20 @@ function field_validation_message($input) {
9732
10114
  function mark_field_validity($input) {
9733
10115
  let $h = $input.parentNode ? $input.parentNode.querySelector(".help") : null;
9734
10116
  let v = $input.validity;
9735
- if (!v || v.valid) {
10117
+ if ((!v || v.valid) && !$input.yui_json_error) {
9736
10118
  $input.classList.remove("is-danger");
9737
10119
  if ($h) {
9738
10120
  $h.textContent = "";
10121
+ $h.removeAttribute("data-i18n");
9739
10122
  $h.style.display = "none";
9740
10123
  }
9741
10124
  return true;
9742
10125
  }
9743
10126
  $input.classList.add("is-danger");
9744
10127
  if ($h) {
10128
+ let key = field_validation_key($input);
10129
+ if (key) $h.setAttribute("data-i18n", key);
10130
+ else $h.removeAttribute("data-i18n");
9745
10131
  $h.textContent = field_validation_message($input);
9746
10132
  $h.style.display = "block";
9747
10133
  }
@@ -9753,6 +10139,12 @@ function mark_field_validity($input) {
9753
10139
  function validate_form(gobj, $form) {
9754
10140
  let validated = true;
9755
10141
  if (!$form.checkValidity()) validated = false;
10142
+ $form.querySelectorAll(".jsoneditor.yui-form-data-input").forEach(($editor) => {
10143
+ if (!check_json_editor($editor)) {
10144
+ validated = false;
10145
+ mark_field_validity($editor);
10146
+ }
10147
+ });
9756
10148
  $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
9757
10149
  if (!$table.tabulator.validate()) validated = false;
9758
10150
  $table.querySelectorAll(".yui-tabulator-table-nested").forEach(($table_nested) => {
@@ -9762,6 +10154,22 @@ function validate_form(gobj, $form) {
9762
10154
  return validated;
9763
10155
  }
9764
10156
  /************************************************************
10157
+ * Does the jsoneditor `$editor` hold json its column can store?
10158
+ * Leaves the answer on the element (`yui_json_error`, an i18n key
10159
+ * or ""), where mark_field_validity() reads it.
10160
+ ************************************************************/
10161
+ function check_json_editor($editor) {
10162
+ let jsoneditor = $editor.jsoneditor;
10163
+ let field_desc = $editor.field_desc;
10164
+ if (!jsoneditor || !field_desc || $editor.hasAttribute("readonly")) {
10165
+ $editor.yui_json_error = "";
10166
+ return true;
10167
+ }
10168
+ let r = parse_json_field(json_editor_value(jsoneditor.get()), field_desc.type);
10169
+ $editor.yui_json_error = r.error;
10170
+ return !r.error;
10171
+ }
10172
+ /************************************************************
9765
10173
  * Function to get input value based on its type
9766
10174
  ************************************************************/
9767
10175
  function getInputValue($input) {
@@ -10013,15 +10421,13 @@ function load_tabulator_data(gobj, $table, value) {
10013
10421
  }
10014
10422
  let tabulator = $table.tabulator;
10015
10423
  if (tabulator.initialized) for (let row of value) gobj_send_event(gobj, "EV_ADD_TABLE_ROW", {
10016
- $row: null,
10017
- $table,
10424
+ table_id: table_identity(gobj, $table),
10018
10425
  record: row,
10019
10426
  loading: true
10020
10427
  }, gobj);
10021
10428
  else tabulator.on("tableBuilt", function() {
10022
10429
  for (let row of value) gobj_send_event(gobj, "EV_ADD_TABLE_ROW", {
10023
- $row: null,
10024
- $table,
10430
+ table_id: table_identity(gobj, $table),
10025
10431
  record: row,
10026
10432
  loading: true
10027
10433
  }, gobj);
@@ -10119,23 +10525,28 @@ function treedb_value_2_form_value(gobj, field_desc, value) {
10119
10525
  return value;
10120
10526
  }
10121
10527
  /************************************************************
10528
+ * A json field's value, parsed. validate_form() refuses a field
10529
+ * that does not parse, so reaching the error here is a path that
10530
+ * skipped it: logged, and the value is handed on AS IT IS. An
10531
+ * empty `{}` / `[]` in its place is a value nobody wrote, and
10532
+ * saved it wipes the column.
10533
+ ************************************************************/
10534
+ function parse_json_value(gobj, field_desc, value) {
10535
+ let r = parse_json_field(value, field_desc.type);
10536
+ if (r.error) {
10537
+ log_error(`${gobj_short_name(gobj)}: field '${field_desc.name}' (${field_desc.type}) holds no valid json, handed on as it is`);
10538
+ return value;
10539
+ }
10540
+ return r.value;
10541
+ }
10542
+ /************************************************************
10122
10543
  * Convert from frontend to backend
10123
10544
  * operation: "create" "update"
10124
10545
  ************************************************************/
10125
10546
  function form_value_2_treedb_value(gobj, field_desc, value) {
10126
10547
  let type = field_desc.type;
10127
10548
  let real_type = field_desc.real_type;
10128
- if (gobj_read_str_attr(gobj, "render_mode") === "edit" && (type === "template" || type === "table" || type === "coordinates")) {
10129
- if (is_string(value)) try {
10130
- value = JSON.parse(value);
10131
- } catch (e) {
10132
- value = type === "table" ? [] : {};
10133
- }
10134
- if (type === "table") {
10135
- if (!is_array(value)) value = [];
10136
- } else if (!is_object(value) && !is_array(value)) value = {};
10137
- return value;
10138
- }
10549
+ if (gobj_read_str_attr(gobj, "render_mode") === "edit" && (type === "template" || type === "table" || type === "coordinates")) return parse_json_value(gobj, field_desc, value);
10139
10550
  switch (type) {
10140
10551
  case "file": break;
10141
10552
  case "fkey":
@@ -10172,13 +10583,7 @@ function form_value_2_treedb_value(gobj, field_desc, value) {
10172
10583
  case "tel":
10173
10584
  case "svg": break;
10174
10585
  case "template":
10175
- if (is_string(value)) try {
10176
- value = JSON.parse(value);
10177
- } catch (e) {
10178
- value = {};
10179
- }
10180
- else if (is_object(value)) {}
10181
- if (!is_object(value)) value = {};
10586
+ value = parse_json_value(gobj, field_desc, value);
10182
10587
  break;
10183
10588
  case "table":
10184
10589
  case "id":
@@ -10192,16 +10597,12 @@ function form_value_2_treedb_value(gobj, field_desc, value) {
10192
10597
  value = parseInt(value) || 0;
10193
10598
  break;
10194
10599
  case "object":
10195
- case "dict": break;
10600
+ case "dict":
10601
+ value = parse_json_value(gobj, field_desc, value);
10602
+ break;
10196
10603
  case "array":
10197
10604
  case "list":
10198
- if (is_string(value)) try {
10199
- value = JSON.parse(value);
10200
- } catch (e) {
10201
- value = [];
10202
- }
10203
- else if (is_array(value)) {}
10204
- if (!is_array(value)) value = [];
10605
+ value = parse_json_value(gobj, field_desc, value);
10205
10606
  break;
10206
10607
  case "real":
10207
10608
  value = parseFloat(value) || 0;
@@ -10210,12 +10611,7 @@ function form_value_2_treedb_value(gobj, field_desc, value) {
10210
10611
  value = parseBoolean(value);
10211
10612
  break;
10212
10613
  case "blob":
10213
- if (is_string(value)) try {
10214
- value = JSON.parse(value);
10215
- } catch (e) {
10216
- value = {};
10217
- }
10218
- else if (is_object(value)) {} else if (is_array(value)) {} else value = {};
10614
+ value = parse_json_value(gobj, field_desc, value);
10219
10615
  break;
10220
10616
  case "number": break;
10221
10617
  case "coordinates":
@@ -10339,9 +10735,13 @@ function ac_set_file_preview(gobj, event, kw, src) {
10339
10735
  * or from load_tabulator_data() to load data from backend
10340
10736
  ************************************************************/
10341
10737
  function ac_add_table_row(gobj, event, kw, src) {
10342
- let $row = kw["$row"];
10343
- let $table = kw.$table;
10344
- let tabulator = $table.tabulator;
10738
+ let table_id = kw.table_id;
10739
+ let $table = find_table(gobj, table_id);
10740
+ let tabulator = $table ? $table.tabulator : null;
10741
+ if (!tabulator) {
10742
+ log_error(`${gobj_short_name(gobj)}: EV_ADD_TABLE_ROW to a table that is gone: '${table_id}'`);
10743
+ return -1;
10744
+ }
10345
10745
  let record = kw.record;
10346
10746
  let loading = kw.loading;
10347
10747
  tabulator.addRow(record).then(function(row) {
@@ -10355,12 +10755,13 @@ function ac_add_table_row(gobj, event, kw, src) {
10355
10755
  }
10356
10756
  });
10357
10757
  }
10358
- }).catch(function(error) {});
10758
+ }).catch(function(error) {
10759
+ log_error(`${gobj_short_name(gobj)}: cannot add a table row: ${error}`);
10760
+ });
10359
10761
  setTimeout(function() {
10360
- if ($row) {
10361
- let $tabulator = $row.closest(".yui-tabulator-table");
10362
- if ($tabulator && $tabulator.tabulator) $tabulator.tabulator.redraw();
10363
- } else tabulator.redraw();
10762
+ if (gobj_is_destroying(gobj)) return;
10763
+ let $outer = $table.closest(".yui-tabulator-table");
10764
+ if ($outer && $outer.tabulator) $outer.tabulator.redraw();
10364
10765
  }, 30);
10365
10766
  return 0;
10366
10767
  }
@@ -10828,7 +11229,7 @@ function yui_maplibre_relocalize(map, t) {
10828
11229
  *
10829
11230
  * Map Manager
10830
11231
  *
10831
- * Copyright (c) 2025, ArtGins.
11232
+ * Copyright (c) 2025-2026, ArtGins.
10832
11233
  * All Rights Reserved.
10833
11234
  ***********************************************************************/
10834
11235
  /***************************************************************
@@ -10974,9 +11375,22 @@ function mt_start$16(gobj) {
10974
11375
  function mt_stop$16(gobj) {
10975
11376
  let shell = yui_shell_of(gobj);
10976
11377
  if (shell) gobj_unsubscribe_event(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
11378
+ retire_marker_windows(gobj);
11379
+ gobj_stop_children(gobj);
10977
11380
  return 0;
10978
11381
  }
10979
11382
  /***************************************************************
11383
+ * Destroy the windows the markers opened.
11384
+ ***************************************************************/
11385
+ function retire_marker_windows(gobj) {
11386
+ let windows = gobj_match_children(gobj, { __gclass_name__: "C_YUI_WINDOW" }) || [];
11387
+ for (let win of windows) {
11388
+ if (gobj_is_running(win)) gobj_stop(win);
11389
+ gobj_stop_children(win);
11390
+ gobj_destroy(win);
11391
+ }
11392
+ }
11393
+ /***************************************************************
10980
11394
  * Framework Method: Destroy
10981
11395
  ***************************************************************/
10982
11396
  function mt_destroy$16(gobj) {
@@ -11263,52 +11677,24 @@ function find_device(gobj, id) {
11263
11677
  return null;
11264
11678
  }
11265
11679
  /************************************************************
11266
- * Event handler for click
11680
+ * Event handler for click: maplibre's callback only turns the
11681
+ * click into an event; the work is ac_marker_clicked().
11682
+ * Plain json: the marker's identity and where it is.
11267
11683
  ************************************************************/
11268
11684
  function onClick(gobj, e) {
11269
- const map = gobj.priv.xmap;
11270
- const coordinates = e.features[0].geometry.coordinates.slice();
11271
- const properties = e.features[0].properties;
11272
- const gobj_service = properties.gobj_service_name ? gobj_find_service(properties.gobj_service_name, false) : null;
11273
- if (gobj_service) {
11274
- let window_service_name = `window-map-${clean_name(gobj_name(gobj_service))}`;
11275
- let popupContent = createElement2([
11276
- "div",
11277
- { class: "xmap columns m-0 p-0 is-flex-wrap-wrap" },
11278
- gobj_read_attr(gobj_service, "$container")
11279
- ]);
11280
- let gobj_window = gobj_create_service(window_service_name, "C_YUI_WINDOW", {
11281
- $parent: document.getElementById("top-layer"),
11282
- width: 700,
11283
- height: 500,
11284
- auto_save_size_and_position: false,
11285
- center: true,
11286
- showMax: false,
11287
- content_size: true,
11288
- title_prefix: gobj_name(gobj_service),
11289
- title: "",
11290
- icon: "yi-location-dot",
11291
- logical_class: "MAP_MARKER_WINDOW",
11292
- body: popupContent
11293
- }, gobj);
11294
- if (!gobj_window) {
11295
- log_error(`${gobj_name(gobj)}: cannot create the marker window`);
11296
- return;
11297
- }
11298
- gobj_start(gobj_window);
11299
- } else {
11300
- const popup = new maplibregl.Popup({
11301
- closeButton: true,
11302
- closeOnClick: true,
11303
- closeOnMove: true,
11304
- anchor: "center",
11305
- maxWidth: "none"
11306
- });
11307
- const popupContent = `
11308
- <b>${properties.name}</b><br>Id: ${properties.id}
11309
- `;
11310
- popup.setLngLat(coordinates).setHTML(popupContent).addTo(map);
11685
+ let feature = e && e.features && e.features[0];
11686
+ if (!feature) {
11687
+ log_error(`${gobj_name(gobj)}: marker click with no feature`);
11688
+ return;
11311
11689
  }
11690
+ let properties = feature.properties || {};
11691
+ let coordinates = feature.geometry.coordinates.slice();
11692
+ gobj_send_event(gobj, "EV_MARKER_CLICKED", {
11693
+ gobj_service_name: properties.gobj_service_name || "",
11694
+ name: properties.name !== void 0 ? String(properties.name) : "",
11695
+ id: properties.id !== void 0 ? String(properties.id) : "",
11696
+ coordinates
11697
+ }, gobj);
11312
11698
  }
11313
11699
  /************************************************************
11314
11700
  * Event handlers for dragging
@@ -11417,6 +11803,68 @@ function ac_refresh$7(gobj, event, kw, src) {
11417
11803
  return 0;
11418
11804
  }
11419
11805
  /************************************************************
11806
+ * EV_MARKER_CLICKED {gobj_service_name, name, id, coordinates}
11807
+ *
11808
+ * A marker backed by a gobj service opens that service's view in
11809
+ * a window -- ONE per marker: a second click is told to the open
11810
+ * one (EV_SHOW). (It created a second window under the same service
11811
+ * name, moved the one $container into it and left the first one
11812
+ * empty; closing the first then unregistered the second's name.)
11813
+ * A marker without a service gets a popup with its name and id.
11814
+ ************************************************************/
11815
+ function ac_marker_clicked(gobj, event, kw, src) {
11816
+ const map = gobj.priv.xmap;
11817
+ const gobj_service = kw.gobj_service_name ? gobj_find_service(kw.gobj_service_name, false) : null;
11818
+ if (gobj_service) {
11819
+ let window_service_name = `window-map-${clean_name(gobj_name(gobj_service))}`;
11820
+ let gobj_window = gobj_find_service(window_service_name, false);
11821
+ if (gobj_window) {
11822
+ gobj_send_event(gobj_window, "EV_SHOW", {}, gobj);
11823
+ return 0;
11824
+ }
11825
+ let popupContent = createElement2([
11826
+ "div",
11827
+ { class: "xmap columns m-0 p-0 is-flex-wrap-wrap" },
11828
+ gobj_read_attr(gobj_service, "$container")
11829
+ ]);
11830
+ gobj_window = gobj_create_service(window_service_name, "C_YUI_WINDOW", {
11831
+ $parent: document.getElementById("top-layer"),
11832
+ width: 700,
11833
+ height: 500,
11834
+ auto_save_size_and_position: false,
11835
+ center: true,
11836
+ showMax: false,
11837
+ content_size: true,
11838
+ title_prefix: gobj_name(gobj_service),
11839
+ title: "",
11840
+ icon: "yi-location-dot",
11841
+ logical_class: "MAP_MARKER_WINDOW",
11842
+ body: popupContent
11843
+ }, gobj);
11844
+ if (!gobj_window) {
11845
+ log_error(`${gobj_name(gobj)}: cannot create the marker window`);
11846
+ return -1;
11847
+ }
11848
+ gobj_start(gobj_window);
11849
+ return 0;
11850
+ }
11851
+ const popup = new maplibregl.Popup({
11852
+ closeButton: true,
11853
+ closeOnClick: true,
11854
+ closeOnMove: true,
11855
+ anchor: "center",
11856
+ maxWidth: "none"
11857
+ });
11858
+ let $content = document.createElement("div");
11859
+ let $name = document.createElement("b");
11860
+ $name.textContent = kw.name;
11861
+ $content.appendChild($name);
11862
+ $content.appendChild(document.createElement("br"));
11863
+ $content.appendChild(document.createTextNode(`Id: ${kw.id}`));
11864
+ popup.setLngLat(kw.coordinates).setDOMContent($content).addTo(map);
11865
+ return 0;
11866
+ }
11867
+ /************************************************************
11420
11868
  *
11421
11869
  ************************************************************/
11422
11870
  function ac_select(gobj, event, kw, src) {
@@ -11464,6 +11912,7 @@ function create_gclass$16(gclass_name) {
11464
11912
  ["EV_MAP_ON_LOAD", 0],
11465
11913
  ["EV_REFRESH", 0],
11466
11914
  ["EV_SELECT", 0],
11915
+ ["EV_MARKER_CLICKED", 0],
11467
11916
  ["EV_SHOW", 0],
11468
11917
  ["EV_HIDE", 0]
11469
11918
  ], [["ST_IDLE", [
@@ -11497,6 +11946,11 @@ function create_gclass$16(gclass_name) {
11497
11946
  ac_select,
11498
11947
  null
11499
11948
  ],
11949
+ [
11950
+ "EV_MARKER_CLICKED",
11951
+ ac_marker_clicked,
11952
+ null
11953
+ ],
11500
11954
  [
11501
11955
  "EV_SHOW",
11502
11956
  ac_show$11,
@@ -11663,7 +12117,7 @@ function build_ui$14(gobj) {
11663
12117
  class: "C_YUI_UPLOT",
11664
12118
  style: "overflow:auto;"
11665
12119
  }]);
11666
- gobj_write_bool_attr(gobj, "$container", $container);
12120
+ gobj_write_attr(gobj, "$container", $container);
11667
12121
  gobj_write_bool_attr(gobj, "own_container", true);
11668
12122
  }
11669
12123
  let uPlot_options = {
@@ -13017,6 +13471,41 @@ function ensure_drag_canvas_patch() {
13017
13471
  __drag_canvas_patched__ = true;
13018
13472
  }
13019
13473
  //#endregion
13474
+ //#region src/g6_event_kw.js
13475
+ /***********************************************************************
13476
+ * g6_event_kw.js
13477
+ *
13478
+ * The kw an FSM event carries for a G6 pointer event: an identity
13479
+ * and three scalars, never the event. Shared by the three graphs
13480
+ * (C_G6_NODES_TREE, C_YUI_JSON_GRAPH, C_YUI_GOBJ_TREE_JS), which
13481
+ * each had a copy.
13482
+ *
13483
+ * Copyright (c) 2026, ArtGins.
13484
+ * All Rights Reserved.
13485
+ ***********************************************************************/
13486
+ /************************************************************
13487
+ * A G6 event, as PLAIN JSON.
13488
+ *
13489
+ * A kw is dumped by the `machine` trace (`trace_json(kw)`), and a
13490
+ * G6 / @antv/g event is circular: serializing one THROWS, so the
13491
+ * first thing a kw carrying `evt` breaks is the trace the FSM
13492
+ * exists to feed. It also drags a live graph element into a
13493
+ * message that may be read after that element is gone.
13494
+ *
13495
+ * What the actions read of it is an id and three scalars. The
13496
+ * event itself never leaves the callback that received it.
13497
+ ************************************************************/
13498
+ function g6_event_kw(evt) {
13499
+ let target = evt && evt.target ? evt.target : null;
13500
+ let client = evt && evt.client ? evt.client : null;
13501
+ return {
13502
+ id: target && target.id ? String(target.id) : "",
13503
+ shift: !!(evt && evt.shiftKey),
13504
+ client_x: client && typeof client.x === "number" ? client.x : 0,
13505
+ client_y: client && typeof client.y === "number" ? client.y : 0
13506
+ };
13507
+ }
13508
+ //#endregion
13020
13509
  //#region src/c_yui_json_graph.js
13021
13510
  /***********************************************************************
13022
13511
  * c_yui_json_graph.js
@@ -13025,7 +13514,7 @@ function ensure_drag_canvas_patch() {
13025
13514
  * Displays JSON data as a hierarchical graph visualization
13026
13515
  * Migrated from mx_json_viewer.js (mxGraph)
13027
13516
  *
13028
- * Copyright (c) 2025, ArtGins.
13517
+ * Copyright (c) 2025-2026, ArtGins.
13029
13518
  * All Rights Reserved.
13030
13519
  ***********************************************************************/
13031
13520
  /***************************************************************
@@ -13521,7 +14010,7 @@ function build_graph$4(gobj) {
13521
14010
  });
13522
14011
  if (priv.theme) graph.setTheme(priv.theme);
13523
14012
  graph.on(NodeEvent.CLICK, (evt) => {
13524
- gobj_send_event(gobj, "EV_NODE_CLICK", { evt }, gobj);
14013
+ gobj_send_event(gobj, "EV_NODE_CLICK", g6_event_kw(evt), gobj);
13525
14014
  });
13526
14015
  graph.on("aftertransform", () => {
13527
14016
  yui_graph_update_zoom(gobj_read_attr(gobj, "$container"), priv.graph);
@@ -14452,11 +14941,13 @@ function ac_center$4(gobj, event, kw, src) {
14452
14941
  function ac_node_click$4(gobj, event, kw, src) {
14453
14942
  let priv = gobj.priv;
14454
14943
  let graph = priv.graph;
14455
- let node_id = kw.evt.target.id;
14944
+ let node_id = kw.id;
14456
14945
  let nodedata;
14457
14946
  try {
14458
14947
  nodedata = graph.getNodeData(node_id);
14459
- } catch (e) {}
14948
+ } catch (e) {
14949
+ log_warning(`${gobj_short_name(gobj)}: node '${node_id}' clicked, not in the graph: ${e}`);
14950
+ }
14460
14951
  if (priv.anchor_state === "arming") {
14461
14952
  priv.anchor_id = node_id;
14462
14953
  priv.anchor_path = nodedata && nodedata.data ? nodedata.data.path : "";
@@ -15341,7 +15832,7 @@ function push_collapsed_row(ctx, value, segments, depth, key, rows) {
15341
15832
  let key_spec = key === null || key === "" ? null : [
15342
15833
  "span",
15343
15834
  { class: "JSON_KEY" },
15344
- String(key)
15835
+ text_node(key)
15345
15836
  ];
15346
15837
  let stub_text = (info.is_array ? "[" : "{") + (size !== void 0 ? String(size) : "?") + (info.is_array ? "]" : "}");
15347
15838
  let children = [];
@@ -15356,7 +15847,7 @@ function push_collapsed_row(ctx, value, segments, depth, key, rows) {
15356
15847
  children.push([
15357
15848
  "span",
15358
15849
  { class: "JSON_STUB" },
15359
- stub_text
15850
+ text_node(stub_text)
15360
15851
  ]);
15361
15852
  children.push([
15362
15853
  "span",
@@ -15420,7 +15911,7 @@ function toggle_row(gobj, key, size, is_object, depth, path, open, value) {
15420
15911
  body.push([
15421
15912
  "span",
15422
15913
  { class: "JSON_KEY" },
15423
- String(key)
15914
+ text_node(key)
15424
15915
  ]);
15425
15916
  body.push([
15426
15917
  "span",
@@ -15437,7 +15928,7 @@ function toggle_row(gobj, key, size, is_object, depth, path, open, value) {
15437
15928
  if (label) body.push([
15438
15929
  "span",
15439
15930
  { class: "JSON_SUMMARY_ID ml-2" },
15440
- label
15931
+ text_node(label)
15441
15932
  ]);
15442
15933
  return [
15443
15934
  "div",
@@ -15483,7 +15974,7 @@ function leaf_row(key, value, depth) {
15483
15974
  body.push([
15484
15975
  "span",
15485
15976
  { class: "JSON_KEY" },
15486
- String(key)
15977
+ text_node(key)
15487
15978
  ]);
15488
15979
  body.push([
15489
15980
  "span",
@@ -15494,7 +15985,7 @@ function leaf_row(key, value, depth) {
15494
15985
  body.push([
15495
15986
  "span",
15496
15987
  { class: "JSON_VALUE JSON_TYPE_" + type.toUpperCase() },
15497
- text
15988
+ text_node(text)
15498
15989
  ]);
15499
15990
  if (key !== null && is_time_field(String(key))) {
15500
15991
  let wall = format_epoch(value);
@@ -16542,7 +17033,7 @@ function render_diff(gobj) {
16542
17033
  [
16543
17034
  "td",
16544
17035
  { class: "JSON_PAD_DIFF_PATH" },
16545
- row.id
17036
+ text_node(row.id)
16546
17037
  ],
16547
17038
  value_cell("JSON_PAD_DIFF_FROM", row, "from"),
16548
17039
  value_cell("JSON_PAD_DIFF_TO", row, "to")
@@ -18349,7 +18840,7 @@ function render_raw(gobj) {
18349
18840
  let children = [[
18350
18841
  "pre",
18351
18842
  { class: "GCLASS_RAW_BODY" },
18352
- dump.text
18843
+ document.createTextNode(String(dump.text))
18353
18844
  ]];
18354
18845
  if (dump.capped) children.push([
18355
18846
  "div",
@@ -18466,7 +18957,7 @@ function build_head(gobj, model) {
18466
18957
  for (let flag of model.gcflag) items.push([
18467
18958
  "span",
18468
18959
  { class: "GCLASS_CHIP GCLASS_GCFLAG" },
18469
- flag
18960
+ text_node(flag)
18470
18961
  ]);
18471
18962
  let current = gobj_read_str_attr(gobj, "current_state");
18472
18963
  if (current) items.push([
@@ -18528,6 +19019,10 @@ function build_zone(gobj, zone) {
18528
19019
  {
18529
19020
  class: "GCLASS_ZONE_TOGGLE",
18530
19021
  type: "button",
19022
+ title: t(zone.key),
19023
+ "data-i18n-title": zone.key,
19024
+ "aria-label": t(zone.key),
19025
+ "data-i18n-aria-label": zone.key,
18531
19026
  "aria-expanded": collapsed ? "false" : "true"
18532
19027
  },
18533
19028
  [
@@ -18625,7 +19120,7 @@ function flag_chips(flags) {
18625
19120
  return [
18626
19121
  "span",
18627
19122
  { class: cls },
18628
- flag
19123
+ text_node(flag)
18629
19124
  ];
18630
19125
  });
18631
19126
  }
@@ -18642,12 +19137,12 @@ function build_attrs(attrs) {
18642
19137
  [
18643
19138
  "td",
18644
19139
  { class: "GCLASS_CELL_KEY" },
18645
- a.id
19140
+ text_node(a.id)
18646
19141
  ],
18647
19142
  [
18648
19143
  "td",
18649
19144
  { class: "GCLASS_CELL_TYPE" },
18650
- a.type
19145
+ text_node(a.type)
18651
19146
  ],
18652
19147
  [
18653
19148
  "td",
@@ -18657,12 +19152,12 @@ function build_attrs(attrs) {
18657
19152
  [
18658
19153
  "td",
18659
19154
  { class: "GCLASS_CELL_DEFAULT" },
18660
- a.default_value
19155
+ text_node(a.default_value)
18661
19156
  ],
18662
19157
  [
18663
19158
  "td",
18664
19159
  { class: "GCLASS_CELL_DESC" },
18665
- a.description
19160
+ text_node(a.description)
18666
19161
  ]
18667
19162
  ]
18668
19163
  ];
@@ -18730,7 +19225,7 @@ function build_commands(commands) {
18730
19225
  [[
18731
19226
  "td",
18732
19227
  { colspan: "2" },
18733
- c.label
19228
+ text_node(c.label)
18734
19229
  ]]
18735
19230
  ]);
18736
19231
  continue;
@@ -18738,12 +19233,12 @@ function build_commands(commands) {
18738
19233
  let name_items = [[
18739
19234
  "span",
18740
19235
  { class: "GCLASS_CMD_NAME" },
18741
- c.id
19236
+ text_node(c.id)
18742
19237
  ]];
18743
19238
  for (let alias of c.alias) name_items.push([
18744
19239
  "span",
18745
19240
  { class: "GCLASS_CHIP GCLASS_ALIAS" },
18746
- alias
19241
+ text_node(alias)
18747
19242
  ]);
18748
19243
  name_items = name_items.concat(flag_chips(c.flags));
18749
19244
  rows.push([
@@ -18756,7 +19251,7 @@ function build_commands(commands) {
18756
19251
  ], [
18757
19252
  "td",
18758
19253
  { class: "GCLASS_CELL_DESC" },
18759
- c.description
19254
+ text_node(c.description)
18760
19255
  ]]
18761
19256
  ]);
18762
19257
  for (let p of c.parameters) rows.push([
@@ -18774,18 +19269,18 @@ function build_commands(commands) {
18774
19269
  [
18775
19270
  "span",
18776
19271
  { class: "GCLASS_PARAM_NAME" },
18777
- p.id
19272
+ text_node(p.id)
18778
19273
  ],
18779
19274
  [
18780
19275
  "span",
18781
19276
  { class: "GCLASS_PARAM_TYPE" },
18782
- p.type
19277
+ text_node(p.type)
18783
19278
  ]
18784
19279
  ].concat(flag_chips(p.flags))
18785
19280
  ], [
18786
19281
  "td",
18787
19282
  { class: "GCLASS_CELL_DESC" },
18788
- p.description
19283
+ text_node(p.description)
18789
19284
  ]]
18790
19285
  ]);
18791
19286
  }
@@ -18861,11 +19356,11 @@ function build_traces(levels) {
18861
19356
  [[
18862
19357
  "td",
18863
19358
  { class: "GCLASS_CELL_KEY" },
18864
- l.id
19359
+ text_node(l.id)
18865
19360
  ], [
18866
19361
  "td",
18867
19362
  { class: "GCLASS_CELL_DESC" },
18868
- l.description
19363
+ text_node(l.description)
18869
19364
  ]]
18870
19365
  ];
18871
19366
  })
@@ -18902,7 +19397,7 @@ function build_machine(gobj, fsm) {
18902
19397
  let items = [[
18903
19398
  "span",
18904
19399
  { class: "GCLASS_MX_STATE_NAME" },
18905
- state.name
19400
+ text_node(state.name)
18906
19401
  ]];
18907
19402
  if (state.name === current) cls += " is-current";
18908
19403
  if (unreachable.has(state.name)) {
@@ -18932,7 +19427,7 @@ function build_machine(gobj, fsm) {
18932
19427
  [[
18933
19428
  "span",
18934
19429
  {},
18935
- row.event
19430
+ text_node(row.event)
18936
19431
  ]].concat(event_flag_chips(row.flags))
18937
19432
  ]];
18938
19433
  row.cells.forEach(function(cell, i) {
@@ -18954,7 +19449,7 @@ function build_machine(gobj, fsm) {
18954
19449
  if (cell.action) items.push([
18955
19450
  "span",
18956
19451
  { class: "GCLASS_MX_ACTION" },
18957
- cell.action
19452
+ text_node(cell.action)
18958
19453
  ]);
18959
19454
  else if (cell.has_action) items.push([
18960
19455
  "span",
@@ -18983,7 +19478,7 @@ function build_machine(gobj, fsm) {
18983
19478
  items.push([
18984
19479
  "span",
18985
19480
  { class: "GCLASS_MX_NEXT" },
18986
- cell.next_state
19481
+ text_node(cell.next_state)
18987
19482
  ]);
18988
19483
  }
18989
19484
  cells.push([
@@ -19035,7 +19530,7 @@ function build_machine(gobj, fsm) {
19035
19530
  [[
19036
19531
  "span",
19037
19532
  { class: "GCLASS_CHIP GCLASS_PUB_EVENT" },
19038
- p.event
19533
+ text_node(p.event)
19039
19534
  ]].concat(event_flag_chips(p.flags))
19040
19535
  ];
19041
19536
  })
@@ -20538,6 +21033,10 @@ function mt_destroy$9(gobj) {
20538
21033
  cancelAnimationFrame(priv._resize_raf);
20539
21034
  priv._resize_raf = 0;
20540
21035
  }
21036
+ if (priv.find_timer) {
21037
+ clearTimeout(priv.find_timer);
21038
+ priv.find_timer = null;
21039
+ }
20541
21040
  if (priv.graph) {
20542
21041
  priv.graph.destroy();
20543
21042
  priv.graph = null;
@@ -20944,7 +21443,7 @@ function build_graph$2(gobj) {
20944
21443
  save_view_state(gobj);
20945
21444
  });
20946
21445
  graph.on(NodeEvent.CLICK, (evt) => {
20947
- gobj_send_event(gobj, "EV_NODE_CLICK", { evt }, gobj);
21446
+ gobj_send_event(gobj, "EV_NODE_CLICK", g6_event_kw(evt), gobj);
20948
21447
  });
20949
21448
  graph.on(CanvasEvent.CLICK, (evt) => {
20950
21449
  hide_popover(gobj);
@@ -21956,12 +22455,14 @@ function ac_center$2(gobj, event, kw, src) {
21956
22455
  function ac_node_click$3(gobj, event, kw, src) {
21957
22456
  let priv = gobj.priv;
21958
22457
  let graph = priv.graph;
21959
- let node_id = kw.evt.target.id;
22458
+ let node_id = kw.id;
21960
22459
  let node_data = priv.node_by_id && priv.node_by_id[node_id] || null;
21961
22460
  if (!node_data) try {
21962
22461
  let nd = graph.getNodeData(node_id);
21963
22462
  if (nd && nd.data) node_data = nd.data;
21964
- } catch (e) {}
22463
+ } catch (e) {
22464
+ log_warning(`${gobj_short_name(gobj)}: node '${node_id}' clicked, not in the graph: ${e}`);
22465
+ }
21965
22466
  if (!node_data) return 0;
21966
22467
  if (priv.anchor_state === "arming") {
21967
22468
  priv.anchor_id = node_id;
@@ -21972,8 +22473,8 @@ function ac_node_click$3(gobj, event, kw, src) {
21972
22473
  gobj_post_event(gobj, "EV_CENTER_ANCHOR", {}, gobj);
21973
22474
  return 0;
21974
22475
  }
21975
- let client_x = kw.evt && kw.evt.client ? kw.evt.client.x : 0;
21976
- let client_y = kw.evt && kw.evt.client ? kw.evt.client.y : 0;
22476
+ let client_x = kw.client_x || 0;
22477
+ let client_y = kw.client_y || 0;
21977
22478
  show_popover(gobj, node_data, client_x, client_y);
21978
22479
  return 0;
21979
22480
  }
@@ -22492,7 +22993,7 @@ function card_descriptor(it, show_label) {
22492
22993
  class: "yui-nav-label",
22493
22994
  i18n: label
22494
22995
  },
22495
- label
22996
+ text_node(label)
22496
22997
  ]);
22497
22998
  let a_attrs = {
22498
22999
  class: "yui-nav-item yui-nav-card",
@@ -22624,7 +23125,7 @@ function is_decorative(it) {
22624
23125
  var attrs_table$7 = [
22625
23126
  SDATA(data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
22626
23127
  SDATA(data_type_t.DTP_STRING, "menu_id", 0, "", "Id of the menu this nav renders"),
22627
- SDATA(data_type_t.DTP_STRING, "nav_label", 0, "", "Human-readable label for aria/heading; falls back to menu_id"),
23128
+ SDATA(data_type_t.DTP_STRING, "nav_label", 0, "", "i18n key of the label for aria/heading; falls back to 'navigation'"),
22628
23129
  SDATA(data_type_t.DTP_JSON, "menu_items", 0, null, "Array of menu items to render"),
22629
23130
  SDATA(data_type_t.DTP_STRING, "zone", 0, "", "Zone id where this nav lives"),
22630
23131
  SDATA(data_type_t.DTP_STRING, "layout", 0, "vertical", "vertical|icon-bar|tabs|drawer|submenu|accordion"),
@@ -22639,7 +23140,10 @@ var attrs_table$7 = [
22639
23140
  SDATA_END()
22640
23141
  ];
22641
23142
  var __nav_aria_seq__ = 0;
22642
- var PRIVATE_DATA$7 = { click_handler: null };
23143
+ var PRIVATE_DATA$7 = {
23144
+ click_handler: null,
23145
+ key_handler: null
23146
+ };
22643
23147
  var __gclass__$7 = null;
22644
23148
  /******************************
22645
23149
  * Framework Methods
@@ -22675,6 +23179,7 @@ function mt_destroy$7(gobj) {
22675
23179
  let $c = gobj_read_attr(gobj, "$container");
22676
23180
  let priv = gobj.priv;
22677
23181
  if ($c && priv && priv.click_handler) $c.removeEventListener("click", priv.click_handler);
23182
+ if ($c && priv && priv.key_handler) $c.removeEventListener("keydown", priv.key_handler);
22678
23183
  if ($c && $c.parentNode) $c.parentNode.removeChild($c);
22679
23184
  gobj_write_attr(gobj, "$container", null);
22680
23185
  }
@@ -22692,7 +23197,7 @@ function build_ui$7(gobj) {
22692
23197
  }
22693
23198
  let items = gobj_read_attr(gobj, "menu_items") || [];
22694
23199
  let zone = gobj_read_attr(gobj, "zone") || "";
22695
- let menu_id = gobj_read_attr(gobj, "menu_id") || "nav";
23200
+ gobj_read_attr(gobj, "menu_id");
22696
23201
  let $container;
22697
23202
  switch (layout) {
22698
23203
  case "vertical":
@@ -22736,8 +23241,9 @@ function build_ui$7(gobj) {
22736
23241
  if (layout !== "drawer") {
22737
23242
  $container.setAttribute("role", "navigation");
22738
23243
  if (!$container.hasAttribute("aria-label")) {
22739
- let label = gobj_read_attr(gobj, "nav_label") || menu_id;
22740
- $container.setAttribute("aria-label", label);
23244
+ let label = gobj_read_attr(gobj, "nav_label") || "navigation";
23245
+ $container.setAttribute("aria-label", t(label));
23246
+ $container.setAttribute("data-i18n-aria-label", label);
22741
23247
  }
22742
23248
  }
22743
23249
  wire_clicks(gobj, $container);
@@ -22756,6 +23262,7 @@ function rebuild(gobj) {
22756
23262
  let next = $old ? $old.nextSibling : null;
22757
23263
  let was_hidden = !!($old && $old.classList.contains("is-hidden"));
22758
23264
  if ($old && priv.click_handler) $old.removeEventListener("click", priv.click_handler);
23265
+ if ($old && priv.key_handler) $old.removeEventListener("keydown", priv.key_handler);
22759
23266
  build_ui$7(gobj);
22760
23267
  let $new = gobj_read_attr(gobj, "$container");
22761
23268
  if ($new && was_hidden) $new.classList.add("is-hidden");
@@ -22852,7 +23359,7 @@ function render_tabs(gobj, items) {
22852
23359
  if (show_label && !empty_string(it.name)) children.push([
22853
23360
  "span",
22854
23361
  { i18n: it.name },
22855
- it.name
23362
+ text_node(it.name)
22856
23363
  ]);
22857
23364
  if (it.closable) children.push([
22858
23365
  "span",
@@ -22860,6 +23367,7 @@ function render_tabs(gobj, items) {
22860
23367
  class: "icon is-small yui-nav-close ml-2",
22861
23368
  "data-close-item": it.id,
22862
23369
  role: "button",
23370
+ tabindex: "0",
22863
23371
  "aria-label": t("close"),
22864
23372
  "data-i18n-aria-label": "close",
22865
23373
  title: t("close"),
@@ -22870,12 +23378,15 @@ function render_tabs(gobj, items) {
22870
23378
  "aria-hidden": "true"
22871
23379
  }]
22872
23380
  ]);
23381
+ let label = it.name || "";
22873
23382
  let a_attrs = {
22874
23383
  href: it.route ? "#" + it.route : "#",
22875
23384
  "data-item-id": it.id,
22876
- "data-route": it.route || ""
23385
+ "data-route": it.route || "",
23386
+ "aria-label": label || it.id
22877
23387
  };
22878
- let tip = it.tooltip || it.aria_label;
23388
+ if (label) a_attrs["data-i18n-aria-label"] = label;
23389
+ let tip = it.tooltip || it.aria_label || label;
22879
23390
  if (tip) {
22880
23391
  a_attrs.title = tip;
22881
23392
  a_attrs["data-i18n-title"] = tip;
@@ -22948,7 +23459,7 @@ function render_breadcrumb(gobj, items) {
22948
23459
  class: "yui-nav-label",
22949
23460
  i18n: label
22950
23461
  },
22951
- label
23462
+ text_node(label)
22952
23463
  ]);
22953
23464
  }
22954
23465
  let a_attrs = {
@@ -23015,18 +23526,19 @@ function render_backbar(gobj) {
23015
23526
  ], [
23016
23527
  "span",
23017
23528
  label_attrs,
23018
- label
23529
+ text_node(label)
23019
23530
  ]]
23020
23531
  ]
23021
23532
  ]);
23022
23533
  }
23023
23534
  function render_drawer(gobj, items) {
23024
- let menu_id = gobj_read_attr(gobj, "menu_id") || "drawer";
23025
23535
  let wrap = document.createElement("div");
23026
23536
  wrap.className = "yui-drawer";
23027
23537
  wrap.setAttribute("role", "dialog");
23028
23538
  wrap.setAttribute("aria-modal", "true");
23029
- wrap.setAttribute("aria-label", menu_id);
23539
+ let nav_label = gobj_read_attr(gobj, "nav_label") || "navigation";
23540
+ wrap.setAttribute("aria-label", t(nav_label));
23541
+ wrap.setAttribute("data-i18n-aria-label", nav_label);
23030
23542
  let back = document.createElement("div");
23031
23543
  back.className = "yui-drawer-backdrop";
23032
23544
  back.setAttribute("data-close-drawer", "1");
@@ -23034,7 +23546,8 @@ function render_drawer(gobj, items) {
23034
23546
  let panel = document.createElement("div");
23035
23547
  panel.className = "yui-drawer-panel";
23036
23548
  panel.setAttribute("role", "navigation");
23037
- panel.setAttribute("aria-label", menu_id);
23549
+ panel.setAttribute("aria-label", t(nav_label));
23550
+ panel.setAttribute("data-i18n-aria-label", nav_label);
23038
23551
  panel.appendChild(render_vertical(gobj, items));
23039
23552
  wrap.appendChild(back);
23040
23553
  wrap.appendChild(panel);
@@ -23088,7 +23601,13 @@ function render_accordion(gobj, items) {
23088
23601
  "aria-expanded": "false",
23089
23602
  "aria-controls": body_id
23090
23603
  };
23091
- if (!empty_string(head_text)) head_attrs.i18n = head_text;
23604
+ if (!empty_string(head_text)) {
23605
+ head_attrs.i18n = head_text;
23606
+ head_attrs.title = head_text;
23607
+ head_attrs["data-i18n-title"] = head_text;
23608
+ head_attrs["aria-label"] = head_text;
23609
+ head_attrs["data-i18n-aria-label"] = head_text;
23610
+ }
23092
23611
  let $hdr = createElement2([
23093
23612
  "button",
23094
23613
  head_attrs,
@@ -23132,7 +23651,7 @@ function item_li(gobj, it, opts) {
23132
23651
  [
23133
23652
  "span",
23134
23653
  span_attrs,
23135
- label
23654
+ text_node(label)
23136
23655
  ]
23137
23656
  ];
23138
23657
  }
@@ -23153,7 +23672,7 @@ function item_li(gobj, it, opts) {
23153
23672
  class: "yui-nav-label",
23154
23673
  i18n: label
23155
23674
  },
23156
- label
23675
+ text_node(label)
23157
23676
  ] : null;
23158
23677
  let a_class = "yui-nav-item";
23159
23678
  if (stacked || icon_pos === "top" || icon_pos === "bottom") a_class += " yui-nav-stacked";
@@ -23174,7 +23693,7 @@ function item_li(gobj, it, opts) {
23174
23693
  "aria-label": aria_key
23175
23694
  };
23176
23695
  if (label) a_attrs["data-i18n-aria-label"] = label;
23177
- let tip = it.tooltip || it.aria_label;
23696
+ let tip = it.tooltip || it.aria_label || label;
23178
23697
  if (tip) {
23179
23698
  a_attrs.title = tip;
23180
23699
  a_attrs["data-i18n-title"] = tip;
@@ -23210,7 +23729,7 @@ function item_iconbar(gobj, it, opts) {
23210
23729
  class: "yui-nav-label is-size-7",
23211
23730
  i18n: label
23212
23731
  },
23213
- label
23732
+ text_node(label)
23214
23733
  ] : null;
23215
23734
  let children = [];
23216
23735
  if (icon_pos === "bottom") {
@@ -23228,7 +23747,7 @@ function item_iconbar(gobj, it, opts) {
23228
23747
  "aria-label": label || it.id
23229
23748
  };
23230
23749
  if (label) a_attrs["data-i18n-aria-label"] = label;
23231
- let tip = it.tooltip || it.aria_label;
23750
+ let tip = it.tooltip || it.aria_label || label;
23232
23751
  if (tip) {
23233
23752
  a_attrs.title = tip;
23234
23753
  a_attrs["data-i18n-title"] = tip;
@@ -23296,6 +23815,14 @@ function wire_clicks(gobj, $container) {
23296
23815
  };
23297
23816
  $container.addEventListener("click", handler);
23298
23817
  priv.click_handler = handler;
23818
+ let key_handler = (ev) => {
23819
+ if (ev.key !== "Enter" && ev.key !== " ") return;
23820
+ let target = ev.target;
23821
+ if (!target || !target.closest || !target.closest("[data-close-item]")) return;
23822
+ handler(ev);
23823
+ };
23824
+ $container.addEventListener("keydown", key_handler);
23825
+ priv.key_handler = key_handler;
23299
23826
  }
23300
23827
  /***************************
23301
23828
  * Actions
@@ -23350,7 +23877,7 @@ function ac_route_changed(gobj, event, kw, src) {
23350
23877
  return 0;
23351
23878
  }
23352
23879
  function css_escape(s) {
23353
- return String(s).replace(/"/g, "\\\"");
23880
+ return String(s).replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
23354
23881
  }
23355
23882
  /***************************************************************
23356
23883
  * FSM
@@ -23417,12 +23944,12 @@ function render_node(node) {
23417
23944
  class: "ROUTEMAP_NAME",
23418
23945
  i18n: node.label
23419
23946
  },
23420
- node.label
23947
+ text_node(node.label)
23421
23948
  ]);
23422
23949
  if (node.route) row.push([
23423
23950
  "code",
23424
23951
  { class: "ROUTEMAP_ROUTE" },
23425
- node.route
23952
+ text_node(node.route)
23426
23953
  ]);
23427
23954
  if (node.gclass) row.push([
23428
23955
  "span",
@@ -23436,7 +23963,7 @@ function render_node(node) {
23436
23963
  if (node.event) row.push([
23437
23964
  "span",
23438
23965
  { class: "ROUTEMAP_EVENT" },
23439
- node.event
23966
+ text_node(node.event)
23440
23967
  ]);
23441
23968
  if (node.ref) row.push([
23442
23969
  "span",
@@ -23570,6 +24097,8 @@ function build_body(shell, t) {
23570
24097
  type: "text",
23571
24098
  placeholder: t("filter", { defaultValue: "Filter…" }),
23572
24099
  "data-i18n-placeholder": "filter",
24100
+ title: t("filter", { defaultValue: "Filter" }),
24101
+ "data-i18n-title": "filter",
23573
24102
  "aria-label": t("filter", { defaultValue: "Filter" }),
23574
24103
  "data-i18n-aria-label": "filter"
23575
24104
  }]);
@@ -23657,6 +24186,10 @@ function build_body(shell, t) {
23657
24186
  "button",
23658
24187
  {
23659
24188
  class: "button is-small ROUTEMAP_PRINT",
24189
+ title: t("print", { defaultValue: "Print" }),
24190
+ "data-i18n-title": "print",
24191
+ "aria-label": t("print", { defaultValue: "Print" }),
24192
+ "data-i18n-aria-label": "print",
23660
24193
  i18n: "print"
23661
24194
  },
23662
24195
  t("print", { defaultValue: "Print" })
@@ -24646,7 +25179,7 @@ function build_ui$6(gobj) {
24646
25179
  ], [
24647
25180
  "span",
24648
25181
  { class: "TREEDB_TOPICS_SOURCE_URL" },
24649
- source_url
25182
+ text_node(source_url)
24650
25183
  ]]
24651
25184
  ],
24652
25185
  ...graph_items,
@@ -24817,7 +25350,7 @@ function add_tab(gobj, gobj2, id, text, icon) {
24817
25350
  i18n: text,
24818
25351
  class: ""
24819
25352
  },
24820
- text
25353
+ text_node(text)
24821
25354
  ]));
24822
25355
  refresh_language($a, t);
24823
25356
  $a.addEventListener("click", function(ev) {
@@ -25014,7 +25547,7 @@ function add_topic_card(gobj, id, text, icon, desc) {
25014
25547
  class: "yui-nav-label",
25015
25548
  i18n: text
25016
25549
  },
25017
- text
25550
+ text_node(text)
25018
25551
  ]]
25019
25552
  ]);
25020
25553
  $card.addEventListener("click", function(ev) {
@@ -25043,7 +25576,7 @@ function add_topic_card(gobj, id, text, icon, desc) {
25043
25576
  class: "TREEDB_TOPIC_CARD_NAME",
25044
25577
  i18n: text
25045
25578
  },
25046
- text
25579
+ text_node(text)
25047
25580
  ],
25048
25581
  ...topic_card_meta(desc),
25049
25582
  [
@@ -25260,7 +25793,7 @@ function build_topic_info_panel(gobj, $info, topic, desc) {
25260
25793
  if (pkey) push_meta("pkey", [
25261
25794
  "code",
25262
25795
  {},
25263
- pkey
25796
+ text_node(pkey)
25264
25797
  ]);
25265
25798
  if (pkey2s.length > 0) push_meta("pkey2s", [
25266
25799
  "span",
@@ -25268,13 +25801,13 @@ function build_topic_info_panel(gobj, $info, topic, desc) {
25268
25801
  pkey2s.map((name) => [
25269
25802
  "span",
25270
25803
  { class: "tag is-warning" },
25271
- name
25804
+ text_node(name)
25272
25805
  ])
25273
25806
  ]);
25274
25807
  push_meta("tkey", tkey ? [
25275
25808
  "code",
25276
25809
  {},
25277
- tkey
25810
+ text_node(tkey)
25278
25811
  ] : [
25279
25812
  "span",
25280
25813
  {
@@ -27197,46 +27730,46 @@ function yui_selection_bar(t, opts) {
27197
27730
  /***********************************************************************
27198
27731
  * yui_table_filter_clear.js
27199
27732
  *
27200
- * LA ✕ DE LOS FILTROS DE CABECERA DE UNA TABULATOR.
27201
- *
27202
- * Un filtro de columna se pone escribiendo y se quita BORRANDO lo
27203
- * escrito, letra a letra, y no hay nada en la cabecera que diga
27204
- * que se puede quitar. Con varias columnas filtradas, volver a
27205
- * ver la tabla entera es un ejercicio de memoria: cuáles toqué.
27206
- * La ✕ lo dice y lo hace.
27207
- *
27208
- * TRES DECISIONES QUE NO SON OBVIAS:
27209
- *
27210
- * - **Se ve mientras el filtro tenga contenido, con foco o sin
27211
- * él.** Es al revés que la ✕ de un formulario
27212
- * (`yui_inputs.js`), que sólo aparece en el campo que se está
27213
- * editando para no encender un aspa en cada campo relleno. Aquí
27214
- * el caso de uso es justo el contrario: el filtro ya está puesto,
27215
- * el foco está en otra parte, y lo que se quiere es verlo y
27216
- * quitarlo. Escondida tras el foco harían falta dos clics.
27217
- *
27218
- * - **Se borra con la API, no simulando teclas.**
27219
- * `setHeaderFilterValue(field, "")` es lo que Tabulator ofrece, y
27220
- * deja el valor y el filtro consistentes. Sintetizar un `input`
27221
- * sobre el `<input>` depende de a qué escuche el editor de ese
27222
- * filtro, que cambia con el tipo de columna.
27223
- *
27224
- * - **Se recorre la cabecera, no se envuelve el editor.** Las
27225
- * columnas se construyen del esquema del topic, así que no hay un
27226
- * sitio único donde envolver el editor; y la cabecera se rehace
27227
- * sola cuando cambian las columnas. El recorrido es idempotente
27228
- * -- marca lo que ya tiene aspa -- y se dispara con un
27229
- * `querySelector` de una sola pasada, así que repetirlo en cada
27230
- * render no cuesta nada.
27733
+ * THE ✕ OF A TABULATOR'S HEADER FILTERS.
27734
+ *
27735
+ * A column filter is set by typing and removed by DELETING what
27736
+ * was typed, letter by letter, and nothing in the header says it
27737
+ * can be removed. With several columns filtered, getting the
27738
+ * whole table back is an exercise of memory: which ones did I
27739
+ * touch. The ✕ says it and does it.
27740
+ *
27741
+ * THREE DECISIONS THAT ARE NOT OBVIOUS:
27742
+ *
27743
+ * - **It shows while the filter has content, focused or not.**
27744
+ * The opposite of a form's ✕ (`yui_inputs.js`), which appears
27745
+ * only on the field being edited so as not to light a cross on
27746
+ * every filled field. Here the use case is the reverse: the
27747
+ * filter is already set, the focus is elsewhere, and what is
27748
+ * wanted is to see it and remove it. Hidden behind the focus it
27749
+ * would take two clicks.
27750
+ *
27751
+ * - **It clears through the API, not by faking keys.**
27752
+ * `setHeaderFilterValue(field, "")` is what Tabulator offers,
27753
+ * and it keeps the value and the filter consistent. Synthesising
27754
+ * an `input` on the `<input>` depends on what that filter's
27755
+ * editor listens to, which changes with the column type.
27756
+ *
27757
+ * - **The header is walked, the editor is not wrapped.** The
27758
+ * columns are built from the topic's schema, so there is no
27759
+ * single place to wrap the editor; and the header rebuilds
27760
+ * itself when the columns change. The walk is idempotent -- it
27761
+ * marks what already has its cross -- and is triggered by a
27762
+ * one-pass `querySelector`, so repeating it on every render
27763
+ * costs nothing.
27231
27764
  *
27232
27765
  * Copyright (c) 2026, ArtGins.
27233
27766
  * All Rights Reserved.
27234
27767
  ***********************************************************************/
27235
27768
  var MARK = "data-yui-filter-clear";
27236
27769
  /***************************************************************
27237
- * Pon (o repón) la ✕ de cada filtro de cabecera de `table`.
27770
+ * Put (or put back) the ✕ of every header filter of `table`.
27238
27771
  *
27239
- * Idempotente: los que ya la tienen se saltan.
27772
+ * Idempotent: the ones that already have it are skipped.
27240
27773
  ***************************************************************/
27241
27774
  function decorate(table) {
27242
27775
  if (!table || !table.element) return;
@@ -27274,11 +27807,11 @@ function decorate(table) {
27274
27807
  }
27275
27808
  }
27276
27809
  /***************************************************************
27277
- * Engancha la ✕ a una tabla ya creada.
27810
+ * Hook the ✕ onto a table already created.
27278
27811
  *
27279
- * Se llama una vez, con la tabla construida. Los enganches
27280
- * cubren los dos momentos en que la cabecera aparece o se
27281
- * rehace: cuando se construye y cuando cambian las columnas.
27812
+ * Called once, with the table built. The hooks cover the two
27813
+ * moments the header appears or is rebuilt: when it is built
27814
+ * and when the columns change.
27282
27815
  ***************************************************************/
27283
27816
  function yui_table_filter_clear(table) {
27284
27817
  if (!table) return;
@@ -27928,6 +28461,7 @@ function mt_stop$5(gobj) {
27928
28461
  close_cell_file_dialog(gobj);
27929
28462
  close_hook_choice(gobj);
27930
28463
  drop_pending_assets(gobj);
28464
+ drop_pending_pages(gobj);
27931
28465
  table__destroy(gobj);
27932
28466
  }
27933
28467
  /***************************************************************
@@ -28847,6 +29381,7 @@ function create_tabulator(gobj) {
28847
29381
  else try {
28848
29382
  n = tabulator.getDataCount("active");
28849
29383
  } catch (e) {
29384
+ log_warning(`${gobj_short_name(gobj)}: cannot count the table's rows: ${e}`);
28850
29385
  n = 0;
28851
29386
  }
28852
29387
  let paged = gobj_read_bool_attr(gobj, "with_remote_paging");
@@ -29076,12 +29611,14 @@ function build_json_cell_preview(value) {
29076
29611
  {
29077
29612
  class: "JSON_CELL",
29078
29613
  title: t("show json"),
29079
- "data-i18n-title": "show json"
29614
+ "data-i18n-title": "show json",
29615
+ "aria-label": t("show json"),
29616
+ "data-i18n-aria-label": "show json"
29080
29617
  },
29081
29618
  [["span", { class: "JSON_CELL_ICON icon yi-eye" }], [
29082
29619
  "span",
29083
29620
  { class: "JSON_CELL_PREVIEW" },
29084
- text
29621
+ text_node(text)
29085
29622
  ]]
29086
29623
  ]);
29087
29624
  }
@@ -29694,7 +30231,7 @@ function open_cell_file_dialog(gobj, row_id, col_id) {
29694
30231
  [[
29695
30232
  "span",
29696
30233
  { class: "CELL_FILE_ID" },
29697
- id
30234
+ text_node(id)
29698
30235
  ]]
29699
30236
  ]]
29700
30237
  ]));
@@ -29753,7 +30290,7 @@ function fill_cell_file_slot(gobj, pend, answer, error) {
29753
30290
  if (meta) $caption.appendChild(createElement2([
29754
30291
  "span",
29755
30292
  { class: "CELL_FILE_META" },
29756
- meta
30293
+ text_node(meta)
29757
30294
  ]));
29758
30295
  let $open = yui_asset_open_link(answer);
29759
30296
  if ($open) $caption.appendChild($open);
@@ -29830,7 +30367,7 @@ function open_hook_choice_dialog(gobj, targets, parent_id, hook) {
29830
30367
  [[
29831
30368
  "span",
29832
30369
  { i18n: tg.topic_name },
29833
- tg.topic_name
30370
+ text_node(tg.topic_name)
29834
30371
  ]],
29835
30372
  { click: () => {
29836
30373
  gobj_send_event(gobj, "EV_CHOOSE_LINKED", {
@@ -30076,33 +30613,15 @@ function transform__form_value_2_treedb_value(gobj, col, value, operation) {
30076
30613
  case "object":
30077
30614
  case "dict":
30078
30615
  case "template":
30079
- if (is_string(value)) try {
30080
- value = JSON.parse(value);
30081
- } catch (e) {
30082
- value = {};
30083
- }
30084
- else if (is_object(value)) {}
30085
- if (!is_object(value)) value = {};
30086
- break;
30087
30616
  case "array":
30088
30617
  case "list":
30089
- if (is_string(value)) try {
30090
- value = JSON.parse(value);
30091
- } catch (e) {
30092
- value = [];
30093
- }
30094
- else if (is_array(value)) {}
30095
- if (!is_array(value)) value = [];
30096
- break;
30097
30618
  case "coordinates":
30098
- case "blob":
30099
- if (is_string(value)) try {
30100
- value = JSON.parse(value);
30101
- } catch (e) {
30102
- value = {};
30103
- }
30104
- else if (is_object(value)) {} else if (is_array(value)) {} else value = {};
30619
+ case "blob": {
30620
+ let r = parse_json_field(value, field_desc.type);
30621
+ if (r.error) log_error(`${gobj_short_name(gobj)}: column '${col.id}' (${field_desc.type}) holds no valid json, handed on as it is`);
30622
+ else value = r.value;
30105
30623
  break;
30624
+ }
30106
30625
  case "enum":
30107
30626
  switch (field_desc.real_type) {
30108
30627
  case "string":
@@ -31061,6 +31580,21 @@ function request_page(gobj, page, size) {
31061
31580
  });
31062
31581
  }
31063
31582
  /************************************************************
31583
+ * The view stops: no page request is waited for any more. Each
31584
+ * one's watchdog would otherwise fire EV_PAGE_TIMEOUT on a gobj
31585
+ * stopped -- or destroyed -- 20 s later.
31586
+ ************************************************************/
31587
+ function drop_pending_pages(gobj) {
31588
+ let priv = gobj.priv;
31589
+ let pending = priv._pending_pages || {};
31590
+ priv._pending_pages = {};
31591
+ for (let req_id of Object.keys(pending)) {
31592
+ let pend = pending[req_id];
31593
+ if (pend.timer) window.clearTimeout(pend.timer);
31594
+ pend.reject(/* @__PURE__ */ new Error("the view stopped"));
31595
+ }
31596
+ }
31597
+ /************************************************************
31064
31598
  * Settle a parked page request, however it ended.
31065
31599
  ************************************************************/
31066
31600
  function settle_page(gobj, req_id, value, error) {
@@ -60082,6 +60616,7 @@ var attrs_table$4 = [
60082
60616
  SDATA_END()
60083
60617
  ];
60084
60618
  var PRIVATE_DATA$4 = {
60619
+ _drag_unwire: null,
60085
60620
  anchor_id: "",
60086
60621
  anchor_state: "off",
60087
60622
  last_zoom: 1,
@@ -60241,6 +60776,10 @@ function mt_stop$4(gobj) {
60241
60776
  function mt_destroy$4(gobj) {
60242
60777
  let priv = gobj.priv;
60243
60778
  uninstall_fold_listener(gobj);
60779
+ if (priv._drag_unwire) {
60780
+ priv._drag_unwire();
60781
+ priv._drag_unwire = null;
60782
+ }
60244
60783
  if (priv._on_pointerdown_focus) {
60245
60784
  priv.$container.removeEventListener("pointerdown", priv._on_pointerdown_focus, true);
60246
60785
  priv._on_pointerdown_focus = null;
@@ -60396,28 +60935,6 @@ function build_graph$1(gobj) {
60396
60935
  });
60397
60936
  }
60398
60937
  /************************************************************
60399
- * A G6 event, as PLAIN JSON.
60400
- *
60401
- * A kw is dumped by the `machine` trace (`trace_json(kw)`), and a
60402
- * G6 / @antv/g event is circular: serializing one THROWS, so the
60403
- * first thing a kw carrying `evt` breaks is the trace the FSM
60404
- * exists to feed. It also drags a live graph element into a
60405
- * message that may be read after that element is gone.
60406
- *
60407
- * What the actions read of it is an id and three scalars. The
60408
- * event itself never leaves the callback that received it.
60409
- ************************************************************/
60410
- function g6_event_kw(evt) {
60411
- let target = evt && evt.target ? evt.target : null;
60412
- let client = evt && evt.client ? evt.client : null;
60413
- return {
60414
- id: target && target.id ? String(target.id) : "",
60415
- shift: !!(evt && evt.shiftKey),
60416
- client_x: client && typeof client.x === "number" ? client.x : 0,
60417
- client_y: client && typeof client.y === "number" ? client.y : 0
60418
- };
60419
- }
60420
- /************************************************************
60421
60938
  * Configure G6 event handlers
60422
60939
  ************************************************************/
60423
60940
  function configure_events(gobj) {
@@ -63349,6 +63866,7 @@ function start_node_resize(gobj, e, mx, my) {
63349
63866
  function onPointerUp(ev) {
63350
63867
  document.removeEventListener("pointermove", onPointerMove);
63351
63868
  document.removeEventListener("pointerup", onPointerUp);
63869
+ document.removeEventListener("pointercancel", onPointerCancel);
63352
63870
  const dLeft = (currentRect.left - origVpRect.left) / zoom;
63353
63871
  const dTop = (currentRect.top - origVpRect.top) / zoom;
63354
63872
  const dRight = (currentRect.right - origVpRect.right) / zoom;
@@ -63382,8 +63900,20 @@ function start_node_resize(gobj, e, mx, my) {
63382
63900
  mark_graph_dirty(gobj);
63383
63901
  });
63384
63902
  }
63903
+ function onPointerCancel(ev) {
63904
+ document.removeEventListener("pointermove", onPointerMove);
63905
+ document.removeEventListener("pointerup", onPointerUp);
63906
+ document.removeEventListener("pointercancel", onPointerCancel);
63907
+ update_resize_handles_position(gobj);
63908
+ }
63385
63909
  document.addEventListener("pointermove", onPointerMove);
63386
63910
  document.addEventListener("pointerup", onPointerUp);
63911
+ document.addEventListener("pointercancel", onPointerCancel);
63912
+ gobj.priv._drag_unwire = function() {
63913
+ document.removeEventListener("pointermove", onPointerMove);
63914
+ document.removeEventListener("pointerup", onPointerUp);
63915
+ document.removeEventListener("pointercancel", onPointerCancel);
63916
+ };
63387
63917
  }
63388
63918
  /************************************************************
63389
63919
  * Port selection and individual port resizing
@@ -63971,6 +64501,7 @@ function start_link_drag(gobj, e) {
63971
64501
  function onPointerUp(ev) {
63972
64502
  document.removeEventListener("pointermove", onPointerMove);
63973
64503
  document.removeEventListener("pointerup", onPointerUp);
64504
+ document.removeEventListener("pointercancel", onPointerCancel);
63974
64505
  priv.$container.style.cursor = "";
63975
64506
  if (priv._link_drag_svg) {
63976
64507
  priv._link_drag_svg.remove();
@@ -63984,8 +64515,25 @@ function start_link_drag(gobj, e) {
63984
64515
  if (target) try_complete_link(gobj, target.node_id, target.port_key);
63985
64516
  else exit_linking_mode(gobj);
63986
64517
  }
64518
+ function onPointerCancel(ev) {
64519
+ document.removeEventListener("pointermove", onPointerMove);
64520
+ document.removeEventListener("pointerup", onPointerUp);
64521
+ document.removeEventListener("pointercancel", onPointerCancel);
64522
+ priv.$container.style.cursor = "";
64523
+ if (priv._link_drag_svg) {
64524
+ priv._link_drag_svg.remove();
64525
+ priv._link_drag_svg = null;
64526
+ }
64527
+ exit_linking_mode(gobj);
64528
+ }
63987
64529
  document.addEventListener("pointermove", onPointerMove);
63988
64530
  document.addEventListener("pointerup", onPointerUp);
64531
+ document.addEventListener("pointercancel", onPointerCancel);
64532
+ gobj.priv._drag_unwire = function() {
64533
+ document.removeEventListener("pointermove", onPointerMove);
64534
+ document.removeEventListener("pointerup", onPointerUp);
64535
+ document.removeEventListener("pointercancel", onPointerCancel);
64536
+ };
63989
64537
  }
63990
64538
  /************************************************************
63991
64539
  * Find if a canvas point hits a valid hook port during
@@ -64172,6 +64720,7 @@ function start_port_resize(gobj, e) {
64172
64720
  function onPointerUp(ev) {
64173
64721
  document.removeEventListener("pointermove", onPointerMove);
64174
64722
  document.removeEventListener("pointerup", onPointerUp);
64723
+ document.removeEventListener("pointercancel", onPointerCancel);
64175
64724
  const dx = ev.clientX - clientCx;
64176
64725
  const dy = ev.clientY - clientCy;
64177
64726
  let vpR = Math.max(PORT_HANDLE_SIZE, Math.sqrt(dx * dx + dy * dy));
@@ -64194,8 +64743,20 @@ function start_port_resize(gobj, e) {
64194
64743
  mark_graph_dirty(gobj);
64195
64744
  });
64196
64745
  }
64746
+ function onPointerCancel(ev) {
64747
+ document.removeEventListener("pointermove", onPointerMove);
64748
+ document.removeEventListener("pointerup", onPointerUp);
64749
+ document.removeEventListener("pointercancel", onPointerCancel);
64750
+ update_port_resize_handles_position(gobj);
64751
+ }
64197
64752
  document.addEventListener("pointermove", onPointerMove);
64198
64753
  document.addEventListener("pointerup", onPointerUp);
64754
+ document.addEventListener("pointercancel", onPointerCancel);
64755
+ gobj.priv._drag_unwire = function() {
64756
+ document.removeEventListener("pointermove", onPointerMove);
64757
+ document.removeEventListener("pointerup", onPointerUp);
64758
+ document.removeEventListener("pointercancel", onPointerCancel);
64759
+ };
64199
64760
  }
64200
64761
  /************************************************************
64201
64762
  * Edge selection: show a floating properties icon near
@@ -72254,6 +72815,7 @@ var JSON_FIELDS$1 = [
72254
72815
  "properties",
72255
72816
  "pkey2s"
72256
72817
  ];
72818
+ var C_BACKSLASH = "\\\\";
72257
72819
  var JSON_BACKSLASH = "\\\\\\\\";
72258
72820
  var JSON_DQUOTE = "\\\\\\\"";
72259
72821
  var JSON_QUOTE = "\\\\u0027";
@@ -72359,7 +72921,20 @@ function c_scalar(value, key) {
72359
72921
  * themselves.
72360
72922
  ***************************************************************/
72361
72923
  function c_text(text) {
72362
- return text.replace(/\\/g, JSON_BACKSLASH).replace(/"/g, JSON_DQUOTE).replace(/'/g, JSON_QUOTE);
72924
+ return text.replace(/\\/g, JSON_BACKSLASH).replace(/"/g, JSON_DQUOTE).replace(/'/g, JSON_QUOTE).replace(/[\u0000-\u001f\u007f]/g, json_control);
72925
+ }
72926
+ var JSON_SHORT_ESCAPES = {
72927
+ "\n": "n",
72928
+ "\r": "r",
72929
+ " ": "t",
72930
+ "\b": "b",
72931
+ "\f": "f"
72932
+ };
72933
+ function json_control(ch) {
72934
+ if (ch === "\0") return "\\\\ufffd";
72935
+ let short = JSON_SHORT_ESCAPES[ch];
72936
+ if (short) return C_BACKSLASH + short;
72937
+ return "\\\\u" + ch.charCodeAt(0).toString(16).padStart(4, "0");
72363
72938
  }
72364
72939
  /***************************************************************
72365
72940
  * Render a value at `indent`, appending its lines to `lines`.
@@ -74052,7 +74627,7 @@ function render_toolbar(gobj) {
74052
74627
  $trail.push([
74053
74628
  "span",
74054
74629
  { class: "SCHEMA_CRUMB_TREEDB" },
74055
- priv.treedb_id
74630
+ text_node(priv.treedb_id)
74056
74631
  ]);
74057
74632
  }
74058
74633
  if (priv.topic_name) {
@@ -74064,7 +74639,7 @@ function render_toolbar(gobj) {
74064
74639
  $trail.push([
74065
74640
  "span",
74066
74641
  { class: "SCHEMA_CRUMB_TOPIC" },
74067
- priv.topic_name
74642
+ text_node(priv.topic_name)
74068
74643
  ]);
74069
74644
  }
74070
74645
  if (priv.diagram) {
@@ -78680,16 +79255,19 @@ function build_ui(gobj) {
78680
79255
  gobj_write_attr(gobj, "$container", $container);
78681
79256
  }
78682
79257
  function build_mode_button(gobj, mode) {
79258
+ let name = mode_name(mode);
78683
79259
  let $btn = createElement2([
78684
79260
  "button",
78685
79261
  {
78686
79262
  class: `button YUI_PERIOD_MODE YUI_PERIOD_MODE_${mode.id.toUpperCase()}`,
78687
- type: "button"
79263
+ type: "button",
79264
+ title: name,
79265
+ "aria-label": name
78688
79266
  },
78689
79267
  [[
78690
79268
  "span",
78691
79269
  { class: "YUI_PERIOD_MODE_TEXT" },
78692
- mode_name(mode)
79270
+ name
78693
79271
  ]]
78694
79272
  ]);
78695
79273
  $btn.addEventListener("click", () => {
@@ -78711,16 +79289,19 @@ function build_more_menu(gobj) {
78711
79289
  ]);
78712
79290
  for (let mode of priv.modes) {
78713
79291
  if (!mode.overflow) continue;
79292
+ let name = mode_name(mode);
78714
79293
  let $item = createElement2([
78715
79294
  "a",
78716
79295
  {
78717
79296
  class: `dropdown-item YUI_PERIOD_MODE YUI_PERIOD_MODE_${mode.id.toUpperCase()}`,
78718
- href: "#"
79297
+ href: "#",
79298
+ title: name,
79299
+ "aria-label": name
78719
79300
  },
78720
79301
  [[
78721
79302
  "span",
78722
79303
  { class: "YUI_PERIOD_MODE_TEXT" },
78723
- mode_name(mode)
79304
+ name
78724
79305
  ]]
78725
79306
  ]);
78726
79307
  $item.addEventListener("click", (ev) => {
@@ -79018,7 +79599,11 @@ function render_calendar(gobj) {
79018
79599
  "button",
79019
79600
  {
79020
79601
  class: "button is-ghost mt-2 YUI_PERIOD_CAL_TODAY",
79021
- type: "button"
79602
+ type: "button",
79603
+ title: t("today"),
79604
+ "data-i18n-title": "today",
79605
+ "aria-label": t("today"),
79606
+ "data-i18n-aria-label": "today"
79022
79607
  },
79023
79608
  [[
79024
79609
  "span",
@@ -79346,8 +79931,11 @@ function ac_language_changed(gobj, event, kw, src) {
79346
79931
  let priv = gobj.priv;
79347
79932
  for (let mode of priv.modes) {
79348
79933
  if (!mode.$btn) continue;
79934
+ let name = mode_name(mode);
79349
79935
  let $text = mode.$btn.querySelector(".YUI_PERIOD_MODE_TEXT");
79350
- if ($text) $text.textContent = mode_name(mode);
79936
+ if ($text) $text.textContent = name;
79937
+ mode.$btn.setAttribute("title", name);
79938
+ mode.$btn.setAttribute("aria-label", name);
79351
79939
  }
79352
79940
  repaint(gobj);
79353
79941
  if (priv.$calendar) render_calendar(gobj);
@@ -79897,7 +80485,7 @@ function traffic_scalar_row(key, value) {
79897
80485
  let val_children = [[
79898
80486
  "span",
79899
80487
  { class: "TRAFFIC_VAL " + cls },
79900
- text
80488
+ text_node(text)
79901
80489
  ]];
79902
80490
  if (key in TRAFFIC_TS_FIELDS && typeof value === "number") {
79903
80491
  let iso = traffic_iso(value);
@@ -80030,7 +80618,7 @@ function traffic_value_node(key, value) {
80030
80618
  ]] : object_preview_parts(value, count).map((t) => [
80031
80619
  "span",
80032
80620
  { class: "TRAFFIC_PREV " + t.cls },
80033
- t.text
80621
+ text_node(t.text)
80034
80622
  ]);
80035
80623
  return [
80036
80624
  "details",
@@ -80047,7 +80635,7 @@ function traffic_value_node(key, value) {
80047
80635
  [
80048
80636
  "span",
80049
80637
  { class: "TRAFFIC_NEST_KEY" },
80050
- key
80638
+ text_node(key)
80051
80639
  ],
80052
80640
  [
80053
80641
  "span",
@@ -80082,17 +80670,17 @@ function event_spans(e) {
80082
80670
  ], [
80083
80671
  "span",
80084
80672
  { class: "TRAFFIC_EVENT" },
80085
- e.event
80673
+ text_node(e.event)
80086
80674
  ]];
80087
80675
  if (e.command) spans.push([
80088
80676
  "span",
80089
80677
  { class: "TRAFFIC_CMD" },
80090
- e.command
80678
+ text_node(e.command)
80091
80679
  ]);
80092
80680
  if (e.title) spans.push([
80093
80681
  "span",
80094
80682
  { class: "TRAFFIC_SRC" },
80095
- e.title
80683
+ text_node(e.title)
80096
80684
  ]);
80097
80685
  return spans;
80098
80686
  }
@@ -80172,7 +80760,7 @@ function render_full(e) {
80172
80760
  ], [
80173
80761
  "pre",
80174
80762
  { class: "TRAFFIC_FULL" },
80175
- text
80763
+ document.createTextNode(String(text))
80176
80764
  ]];
80177
80765
  return createElement2([
80178
80766
  "div",
@@ -80779,7 +81367,9 @@ function build_control_bar() {
80779
81367
  "data-dir": key,
80780
81368
  type: "button",
80781
81369
  title: t(title),
80782
- "data-i18n-title": title
81370
+ "data-i18n-title": title,
81371
+ "aria-label": t(title),
81372
+ "data-i18n-aria-label": title
80783
81373
  },
80784
81374
  glyph,
80785
81375
  { click: (ev) => {