@yuneta/gobj-ui 7.26.6 → 7.26.7

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.
@@ -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,10 @@ 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();
2368
2390
  if (entry.keep_on_navigate) {
2369
2391
  kept.unshift(entry);
2370
2392
  continue;
@@ -2375,7 +2397,7 @@ function drain_overlays(gobj) {
2375
2397
  log_warning(`C_YUI_SHELL: overlay close on navigation failed: ${e}`);
2376
2398
  }
2377
2399
  }
2378
- for (let entry of kept) priv.overlay_stack.push(entry);
2400
+ priv.overlay_stack.unshift(...kept);
2379
2401
  }
2380
2402
  function retag_overlay_hash(gobj, st, hash) {
2381
2403
  let priv = gobj.priv;
@@ -2514,7 +2536,10 @@ function update_secondary_nav_visibility(gobj, entry) {
2514
2536
  ************************************************************/
2515
2537
  function ac_nav_clicked(gobj, event, kw, src) {
2516
2538
  let route = kw && kw.route || "";
2517
- if (empty_string(route)) return 0;
2539
+ if (empty_string(route)) {
2540
+ log_warning(`C_YUI_SHELL: ${event} with no route, from ${gobj_short_name(src)}`);
2541
+ return -1;
2542
+ }
2518
2543
  route = remembered_position(gobj, route);
2519
2544
  if (gobj_read_attr(gobj, "use_hash") && !route_restores_url(gobj, route)) {
2520
2545
  let target_hash = route_to_hash(route);
@@ -2552,17 +2577,19 @@ function ac_nav_item_close(gobj, event, kw, src) {
2552
2577
  * FSM
2553
2578
  ***************************************************************/
2554
2579
  /***************************************************************
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.
2580
+ * EV_CONNECTION_STATE and EV_ICONS_CHANGED are OPTIONAL facts: a
2581
+ * view that needs one subscribes to it by name. An app that
2582
+ * subscribed to EVERY event of its shell with one attr
2583
+ * (`subscriber`) did not ask for them and does not declare them --
2584
+ * published to it anyway, each would be an FSM error in the app
2585
+ * every time it fires, and adding one to the shell a breaking
2586
+ * change for every such app (7.26.6 did exactly that with
2587
+ * EV_ICONS_CHANGED). So they reach only the subscribers that
2588
+ * declare them. Every other event of the shell goes out as before.
2563
2589
  ***************************************************************/
2590
+ var OPTIONAL_EVENTS = /* @__PURE__ */ new Set(["EV_CONNECTION_STATE", "EV_ICONS_CHANGED"]);
2564
2591
  function mt_publication_pre_filter(gobj, subs, event, kw) {
2565
- if (event !== "EV_CONNECTION_STATE") return 1;
2592
+ if (!OPTIONAL_EVENTS.has(event)) return 1;
2566
2593
  let subscriber = subs && subs.subscriber;
2567
2594
  if (!subscriber || !gobj_has_event(subscriber, event, 0)) return 0;
2568
2595
  return 1;
@@ -2894,7 +2921,7 @@ function yui_shell_set_translator(shell_gobj, t) {
2894
2921
  *
2895
2922
  * The division of labour, unchanged: LIBRARY-built DOM is
2896
2923
  * translated through here; APP view gclasses translate their own
2897
- * DOM (they own a `t` — see mount_view).
2924
+ * DOM (they own a `t` — see build_view_gobj).
2898
2925
  *
2899
2926
  * Silent no-op with no shell or no translator: an app that never
2900
2927
  * registered one keeps the previous behaviour instead of losing
@@ -3571,7 +3598,7 @@ function yui_shell_confirm_yesnocancel(shell, message, opts) {
3571
3598
  *
3572
3599
  * Window - position fixed
3573
3600
  *
3574
- * Copyright (c) 2025, ArtGins.
3601
+ * Copyright (c) 2025-2026, ArtGins.
3575
3602
  * All Rights Reserved.
3576
3603
  ***********************************************************************/
3577
3604
  /***************************************************************
@@ -3654,15 +3681,7 @@ function mt_create$21(gobj) {
3654
3681
  title_prefix: gobj_read_str_attr(gobj, "title_prefix") || "",
3655
3682
  icon: gobj_read_attr(gobj, "icon") || ""
3656
3683
  }, 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
- }
3684
+ } else if (gobj_read_bool_attr(gobj, "back_dismissable")) register_back_overlay(gobj);
3666
3685
  let on_win_resize = function() {
3667
3686
  handleResize(gobj);
3668
3687
  };
@@ -3782,7 +3801,7 @@ function build_default_header(gobj) {
3782
3801
  if (!empty_string(prefix)) items.push([
3783
3802
  "span",
3784
3803
  { class: "WINDOW_TITLE_PREFIX has-text-weight-semibold" },
3785
- prefix
3804
+ document.createTextNode(String(prefix))
3786
3805
  ]);
3787
3806
  if (!empty_string(title)) items.push([
3788
3807
  "span",
@@ -3825,7 +3844,9 @@ function resolve_manager(gobj) {
3825
3844
  let m = gobj_read_pointer_attr(gobj, "manager");
3826
3845
  if (!m) return null;
3827
3846
  if (typeof m === "string") {
3828
- m = gobj_find_service(m, false) || null;
3847
+ let name = m;
3848
+ m = gobj_find_service(name, false) || null;
3849
+ if (!m) log_warning(`${GCLASS_NAME$21}: window manager '${name}' not found: no dock, no minimize`);
3829
3850
  gobj_write_attr(gobj, "manager", m);
3830
3851
  }
3831
3852
  return m;
@@ -3935,6 +3956,8 @@ function build_ui$18(gobj) {
3935
3956
  {
3936
3957
  class: "WINDOW_MIN yui-wc wc-min",
3937
3958
  type: "button",
3959
+ title: t("minimize"),
3960
+ "data-i18n-title": "minimize",
3938
3961
  "aria-label": t("minimize"),
3939
3962
  "data-i18n-aria-label": "minimize",
3940
3963
  style: gobj_read_bool_attr(gobj, "showMin") && gobj_read_pointer_attr(gobj, "manager") ? "" : "display:none;"
@@ -3950,6 +3973,8 @@ function build_ui$18(gobj) {
3950
3973
  {
3951
3974
  class: "WINDOW_MAX yui-wc wc-max",
3952
3975
  type: "button",
3976
+ title: t("maximize"),
3977
+ "data-i18n-title": "maximize",
3953
3978
  "aria-label": t("maximize"),
3954
3979
  "data-i18n-aria-label": "maximize",
3955
3980
  style: gobj_read_bool_attr(gobj, "showMax") ? "" : "display:none;"
@@ -3965,13 +3990,15 @@ function build_ui$18(gobj) {
3965
3990
  {
3966
3991
  class: "WINDOW_CLOSE yui-wc wc-close",
3967
3992
  type: "button",
3993
+ title: t("close"),
3994
+ "data-i18n-title": "close",
3968
3995
  "aria-label": t("close"),
3969
3996
  "data-i18n-aria-label": "close"
3970
3997
  },
3971
3998
  WC_CLOSE,
3972
3999
  { click: (evt) => {
3973
4000
  evt.stopPropagation();
3974
- close_window(gobj);
4001
+ gobj_send_event(gobj, "EV_CLOSE_WINDOW", {}, gobj);
3975
4002
  } }
3976
4003
  ]
3977
4004
  ]
@@ -4107,6 +4134,27 @@ function destroy_ui$13(gobj) {
4107
4134
  }
4108
4135
  }
4109
4136
  /************************************************************
4137
+ * Register this floating window in the shell's overlay history,
4138
+ * so the browser Back closes it.
4139
+ *
4140
+ * The shell takes the entry off its stack BEFORE it calls the
4141
+ * close function (Back, or a route change draining overlays). When
4142
+ * a subscriber of EV_WINDOW_TO_CLOSE vetoes the close, the window
4143
+ * stays up with no entry: Back would no longer close it, and it
4144
+ * would float over the next views. So a window that survives its
4145
+ * own close function registers again.
4146
+ ************************************************************/
4147
+ function register_back_overlay(gobj) {
4148
+ let shell = yui_shell_of(gobj);
4149
+ if (!shell) return;
4150
+ let overlay = yui_shell_register_overlay(shell, function() {
4151
+ gobj_write_attr(gobj, "back_overlay", null);
4152
+ close_window(gobj);
4153
+ if (!gobj_is_destroying(gobj) && !gobj_read_attr(gobj, "back_overlay")) register_back_overlay(gobj);
4154
+ }, { keep_on_navigate: gobj_read_bool_attr(gobj, "keep_on_navigate") });
4155
+ gobj_write_attr(gobj, "back_overlay", overlay);
4156
+ }
4157
+ /************************************************************
4110
4158
  *
4111
4159
  ************************************************************/
4112
4160
  function close_window(gobj) {
@@ -4124,12 +4172,12 @@ function close_window(gobj) {
4124
4172
  no_label: "no",
4125
4173
  cancel_label: "cancel"
4126
4174
  }).then(function(answer) {
4127
- if (answer === "yes") {
4128
- if (on_close) on_close();
4129
- gobj_stop(gobj);
4130
- gobj_stop_children(gobj);
4131
- gobj_destroy(gobj);
4132
- }
4175
+ if (answer !== "yes") return;
4176
+ if (gobj_is_destroying(gobj)) return;
4177
+ if (on_close) on_close();
4178
+ if (gobj_is_running(gobj)) gobj_stop(gobj);
4179
+ gobj_stop_children(gobj);
4180
+ gobj_destroy(gobj);
4133
4181
  });
4134
4182
  }
4135
4183
  /************************************************************
@@ -4164,8 +4212,12 @@ function set_max_icon(gobj, maximized) {
4164
4212
  if (!$container) return;
4165
4213
  let $btn = $container.querySelector(".wc-max");
4166
4214
  if ($btn) {
4215
+ let key = maximized ? "restore" : "maximize";
4167
4216
  $btn.innerHTML = maximized ? WC_RESTORE : WC_MAX;
4168
- $btn.setAttribute("aria-label", maximized ? "restore" : "maximize");
4217
+ $btn.setAttribute("title", t(key));
4218
+ $btn.setAttribute("data-i18n-title", key);
4219
+ $btn.setAttribute("aria-label", t(key));
4220
+ $btn.setAttribute("data-i18n-aria-label", key);
4169
4221
  }
4170
4222
  }
4171
4223
  /************************************************************
@@ -4808,7 +4860,7 @@ function ac_register_window(gobj, event, kw, src) {
4808
4860
  if (prefix) label_items.push([
4809
4861
  "span",
4810
4862
  { class: "yui-dock-label-prefix" },
4811
- prefix
4863
+ document.createTextNode(String(prefix))
4812
4864
  ]);
4813
4865
  if (title_key) label_items.push([
4814
4866
  "span",
@@ -4821,7 +4873,7 @@ function ac_register_window(gobj, event, kw, src) {
4821
4873
  if (label_items.length === 0) label_items.push([
4822
4874
  "span",
4823
4875
  { class: "yui-dock-label-kind" },
4824
- title
4876
+ document.createTextNode(String(title))
4825
4877
  ]);
4826
4878
  let entry = {
4827
4879
  gobj: win,
@@ -4848,6 +4900,8 @@ function ac_register_window(gobj, event, kw, src) {
4848
4900
  {
4849
4901
  class: "yui-dock-close",
4850
4902
  type: "button",
4903
+ title: t("close"),
4904
+ "data-i18n-title": "close",
4851
4905
  "aria-label": t("close"),
4852
4906
  "data-i18n-aria-label": "close"
4853
4907
  },
@@ -5112,6 +5166,8 @@ function build_ui$17(gobj) {
5112
5166
  "button",
5113
5167
  {
5114
5168
  class: "yui-pager-back button is-white is-hidden",
5169
+ title: t("back"),
5170
+ "data-i18n-title": "back",
5115
5171
  "aria-label": t("back"),
5116
5172
  "data-i18n-aria-label": "back"
5117
5173
  },
@@ -5137,6 +5193,8 @@ function build_ui$17(gobj) {
5137
5193
  "button",
5138
5194
  {
5139
5195
  class: "yui-pager-discard button is-white is-hidden",
5196
+ title: t("discard"),
5197
+ "data-i18n-title": "discard",
5140
5198
  "aria-label": t("discard"),
5141
5199
  "data-i18n-aria-label": "discard"
5142
5200
  },
@@ -5217,13 +5275,12 @@ function render_header(gobj) {
5217
5275
  let $discard = $container.querySelector(".yui-pager-discard");
5218
5276
  $back.classList.toggle("is-hidden", !model.show_back);
5219
5277
  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
- }
5278
+ let back_key = model.back_kind === "close" ? "close" : "back";
5279
+ $back_icon.className = back_key === "close" ? "yi-xmark" : "yi-arrow-left";
5280
+ $back.setAttribute("title", t(back_key));
5281
+ $back.setAttribute("data-i18n-title", back_key);
5282
+ $back.setAttribute("aria-label", t(back_key));
5283
+ $back.setAttribute("data-i18n-aria-label", back_key);
5227
5284
  $discard.classList.toggle("is-hidden", !model.show_discard);
5228
5285
  $title.setAttribute("data-i18n", model.title);
5229
5286
  $title.textContent = t(model.title);
@@ -5631,6 +5688,8 @@ function mt_destroy$18(gobj) {
5631
5688
  * Build UI
5632
5689
  ************************************************************/
5633
5690
  function build_ui$16(gobj) {
5691
+ let back_label = gobj_read_attr(gobj, "back_label");
5692
+ let next_label = gobj_read_attr(gobj, "next_label");
5634
5693
  let $container = createElement2([
5635
5694
  "div",
5636
5695
  {
@@ -5678,8 +5737,10 @@ function build_ui$16(gobj) {
5678
5737
  "button",
5679
5738
  {
5680
5739
  class: "yui-wizard-back button",
5681
- "aria-label": t("back"),
5682
- "data-i18n-aria-label": "back"
5740
+ title: t(back_label),
5741
+ "data-i18n-title": back_label,
5742
+ "aria-label": t(back_label),
5743
+ "data-i18n-aria-label": back_label
5683
5744
  },
5684
5745
  [[
5685
5746
  "span",
@@ -5689,9 +5750,9 @@ function build_ui$16(gobj) {
5689
5750
  "span",
5690
5751
  {
5691
5752
  class: "is-hidden-mobile",
5692
- i18n: "back"
5753
+ i18n: back_label
5693
5754
  },
5694
- "back"
5755
+ back_label
5695
5756
  ]],
5696
5757
  { click: function(evt) {
5697
5758
  evt.stopPropagation();
@@ -5701,16 +5762,18 @@ function build_ui$16(gobj) {
5701
5762
  "button",
5702
5763
  {
5703
5764
  class: "yui-wizard-primary button is-link",
5704
- "aria-label": t("next"),
5705
- "data-i18n-aria-label": "next"
5765
+ title: t(next_label),
5766
+ "data-i18n-title": next_label,
5767
+ "aria-label": t(next_label),
5768
+ "data-i18n-aria-label": next_label
5706
5769
  },
5707
5770
  [[
5708
5771
  "span",
5709
5772
  {
5710
5773
  class: "yui-wizard-primary-label",
5711
- i18n: "next"
5774
+ i18n: next_label
5712
5775
  },
5713
- "next"
5776
+ next_label
5714
5777
  ]],
5715
5778
  { click: function(evt) {
5716
5779
  evt.stopPropagation();
@@ -5769,14 +5832,19 @@ function render_chrome(gobj) {
5769
5832
  let $title = $container.querySelector(".yui-wizard-title");
5770
5833
  let $counter = $container.querySelector(".yui-wizard-counter");
5771
5834
  let $back = $container.querySelector(".yui-wizard-back");
5835
+ let $primary = $container.querySelector(".yui-wizard-primary");
5772
5836
  let $plabel = $container.querySelector(".yui-wizard-primary-label");
5773
- $title.setAttribute("i18n", model.title);
5774
- $title.textContent = model.title;
5837
+ $title.setAttribute("data-i18n", model.title);
5838
+ $title.textContent = t(model.title);
5775
5839
  if (model.count > 0) $counter.textContent = `${model.idx + 1} / ${model.count}`;
5776
5840
  else $counter.textContent = "";
5777
5841
  $back.classList.toggle("is-hidden", !model.show_back);
5778
- $plabel.setAttribute("i18n", model.primary_label);
5779
- $plabel.textContent = model.primary_label;
5842
+ $plabel.setAttribute("data-i18n", model.primary_label);
5843
+ $plabel.textContent = t(model.primary_label);
5844
+ $primary.setAttribute("title", t(model.primary_label));
5845
+ $primary.setAttribute("data-i18n-title", model.primary_label);
5846
+ $primary.setAttribute("aria-label", t(model.primary_label));
5847
+ $primary.setAttribute("data-i18n-aria-label", model.primary_label);
5780
5848
  for (let i = 0; i < priv.steps.length; i++) {
5781
5849
  let s = priv.steps[i];
5782
5850
  if (s.$el) s.$el.classList.toggle("is-hidden", i !== model.idx);
@@ -7990,6 +8058,107 @@ function datetime_local_to_epoch(value) {
7990
8058
  return Math.floor(date.getTime() / 1e3);
7991
8059
  }
7992
8060
  //#endregion
8061
+ //#region src/form_json_field.js
8062
+ /***********************************************************************
8063
+ * form_json_field.js
8064
+ *
8065
+ * Pure logic of a json field of C_YUI_FORM: what a jsoneditor
8066
+ * holds, read as the value its column stores.
8067
+ *
8068
+ * The editor answers its content in one of two shapes -- {json}
8069
+ * (tree mode) or {text} (text mode, whatever the reader typed).
8070
+ * A text that does not parse used to be caught and replaced by
8071
+ * `{}` or `[]`, and SAVED: a trailing comma wiped the column, with
8072
+ * no log and no message. A text that is not json, or json of the
8073
+ * wrong shape (a list in a dict column), is an error now, and the
8074
+ * form refuses to save while a field holds one.
8075
+ *
8076
+ * Copyright (c) 2026, ArtGins.
8077
+ * All Rights Reserved.
8078
+ ***********************************************************************/
8079
+ var SHAPE_OF_TYPE = {
8080
+ object: "dict",
8081
+ dict: "dict",
8082
+ template: "dict",
8083
+ array: "list",
8084
+ list: "list",
8085
+ table: "list",
8086
+ coordinates: "container"
8087
+ };
8088
+ /************************************************************
8089
+ * The shape `type` stores: "dict", "list", "container" or "any".
8090
+ ************************************************************/
8091
+ function json_field_shape(type) {
8092
+ return SHAPE_OF_TYPE[type] || "any";
8093
+ }
8094
+ /************************************************************
8095
+ * The empty value of a shape: what a blank editor stores.
8096
+ ************************************************************/
8097
+ function json_field_empty(shape) {
8098
+ if (shape === "list") return [];
8099
+ return {};
8100
+ }
8101
+ function value_fits(value, shape) {
8102
+ let is_list = Array.isArray(value);
8103
+ let is_dict = value !== null && typeof value === "object" && !is_list;
8104
+ switch (shape) {
8105
+ case "dict": return is_dict;
8106
+ case "list": return is_list;
8107
+ case "container": return is_dict || is_list;
8108
+ default: return true;
8109
+ }
8110
+ }
8111
+ /************************************************************
8112
+ * Parse what a json field holds.
8113
+ *
8114
+ * `value` is a json string (what the form reads out of an editor)
8115
+ * or an already parsed value; an editor's content goes through
8116
+ * json_editor_value() first.
8117
+ * Returns {value, error}: `error` is "" when the value is good, else
8118
+ * an i18n key; `value` is then the empty value of the shape and must
8119
+ * NOT be stored.
8120
+ *
8121
+ * A blank text is not an error: it is the empty value.
8122
+ ************************************************************/
8123
+ function parse_json_field(value, type) {
8124
+ let shape = json_field_shape(type);
8125
+ if (typeof value === "string") {
8126
+ if (value.trim() === "") return {
8127
+ value: json_field_empty(shape),
8128
+ error: ""
8129
+ };
8130
+ try {
8131
+ value = JSON.parse(value);
8132
+ } catch (e) {
8133
+ return {
8134
+ value: json_field_empty(shape),
8135
+ error: "invalid json"
8136
+ };
8137
+ }
8138
+ }
8139
+ if (value === void 0) return {
8140
+ value: json_field_empty(shape),
8141
+ error: ""
8142
+ };
8143
+ if (!value_fits(value, shape)) return {
8144
+ value: json_field_empty(shape),
8145
+ error: "invalid json"
8146
+ };
8147
+ return {
8148
+ value,
8149
+ error: ""
8150
+ };
8151
+ }
8152
+ /************************************************************
8153
+ * What a jsoneditor content ({text} or {json}) holds: the
8154
+ * text as typed, or the tree-mode json.
8155
+ ************************************************************/
8156
+ function json_editor_value(content) {
8157
+ if (!content) return;
8158
+ if (content.text !== void 0) return content.text;
8159
+ return content.json;
8160
+ }
8161
+ //#endregion
7993
8162
  //#region src/c_yui_form.js
7994
8163
  /***********************************************************************
7995
8164
  * c_yui_form.js
@@ -8354,10 +8523,61 @@ function build_ui$15(gobj) {
8354
8523
  function destroy_ui$10(gobj) {
8355
8524
  let $container = gobj_read_attr(gobj, "$container");
8356
8525
  if ($container) {
8526
+ destroy_widgets(gobj, $container);
8357
8527
  if ($container.parentNode) $container.parentNode.removeChild($container);
8358
8528
  gobj_write_attr(gobj, "$container", null);
8359
8529
  }
8360
8530
  }
8531
+ /************************************************************
8532
+ * The icon a table cell draws as its control (delete the row,
8533
+ * add a nested row): an element, so it carries its name. Drawn
8534
+ * by Tabulator on every render, so t() at render time is
8535
+ * current.
8536
+ ************************************************************/
8537
+ function cell_icon(icon_class, key) {
8538
+ let $i = document.createElement("i");
8539
+ $i.className = icon_class;
8540
+ $i.setAttribute("title", t(key));
8541
+ $i.setAttribute("aria-label", t(key));
8542
+ return $i;
8543
+ }
8544
+ /************************************************************
8545
+ * Destroy the third-party widgets the form built. Removing
8546
+ * their DOM is not enough: Tom Select keeps listeners on
8547
+ * `document` and `window`, the jsoneditor is a live Svelte app
8548
+ * and a Tabulator keeps its observers -- each one a closure over
8549
+ * this form, alive for the life of the page. Nested tables go
8550
+ * first: their parent's destroy drops the rows they hang from.
8551
+ ************************************************************/
8552
+ function destroy_widgets(gobj, $container) {
8553
+ let destroy = (what, widget) => {
8554
+ try {
8555
+ widget.destroy();
8556
+ } catch (e) {
8557
+ log_warning(`${gobj_short_name(gobj)}: cannot destroy ${what}: ${e}`);
8558
+ }
8559
+ };
8560
+ $container.querySelectorAll(".yui-tabulator-table-nested").forEach(($el) => {
8561
+ if ($el.tabulator) {
8562
+ destroy("nested table", $el.tabulator);
8563
+ $el.tabulator = null;
8564
+ }
8565
+ });
8566
+ $container.querySelectorAll(".yui-form-data-input").forEach(($el) => {
8567
+ if ($el.tom_select) {
8568
+ destroy("select", $el.tom_select);
8569
+ $el.tom_select = null;
8570
+ }
8571
+ if ($el.jsoneditor) {
8572
+ destroy("json editor", $el.jsoneditor);
8573
+ $el.jsoneditor = null;
8574
+ }
8575
+ if ($el.tabulator) {
8576
+ destroy("table", $el.tabulator);
8577
+ $el.tabulator = null;
8578
+ }
8579
+ });
8580
+ }
8361
8581
  /******************************************************************
8362
8582
  * Build form with bulma and createElement2
8363
8583
  ******************************************************************/
@@ -8911,7 +9131,13 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
8911
9131
  { class: "" },
8912
9132
  [[
8913
9133
  "button",
8914
- { class: "button p-1" },
9134
+ {
9135
+ class: "button p-1",
9136
+ title: t("add"),
9137
+ "data-i18n-title": "add",
9138
+ "aria-label": t("add"),
9139
+ "data-i18n-aria-label": "add"
9140
+ },
8915
9141
  [[
8916
9142
  "span",
8917
9143
  { class: "icon m-0" },
@@ -9069,7 +9295,7 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9069
9295
  value: option,
9070
9296
  i18n: option
9071
9297
  },
9072
- option
9298
+ document.createTextNode(String(option))
9073
9299
  ]),
9074
9300
  { "change": function(evt) {
9075
9301
  gobj_send_event(gobj, "EV_RECORD_CHANGED", {}, gobj);
@@ -9148,13 +9374,19 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9148
9374
  break;
9149
9375
  }
9150
9376
  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);
9377
+ let label_key = String(options === void 0 || options === null ? "" : options);
9378
+ $extend = createElement2([
9379
+ "label",
9380
+ { class: "radio" },
9381
+ [["input", {
9382
+ type: "radio",
9383
+ name
9384
+ }], [
9385
+ "span",
9386
+ { i18n: label_key },
9387
+ label_key
9388
+ ]]
9389
+ ]);
9158
9390
  $control.appendChild($extend);
9159
9391
  break;
9160
9392
  }
@@ -9174,6 +9406,10 @@ function create_form_field(gobj, $form, prefix, field_desc, { tag, inputType, na
9174
9406
  props: {
9175
9407
  readOnly: !!readonly,
9176
9408
  onChange: function() {
9409
+ if ($extend.yui_json_error) {
9410
+ check_json_editor($extend);
9411
+ mark_field_validity($extend);
9412
+ }
9177
9413
  gobj_send_event(gobj, "EV_RECORD_CHANGED", {}, gobj);
9178
9414
  },
9179
9415
  timestampTag: function({ field, value, path }) {
@@ -9497,7 +9733,7 @@ function create_tabulator$1(gobj, $extend, name, template) {
9497
9733
  };
9498
9734
  if (gobj_read_bool_attr(gobj, "with_delete_row_btn")) columns.push({
9499
9735
  formatter: function(cell, formatterParams) {
9500
- return "<i style=\"\" class=\"yi-trash has-text-danger\"></i>";
9736
+ return cell_icon("yi-trash has-text-danger", "delete");
9501
9737
  },
9502
9738
  width: 40,
9503
9739
  hozAlign: "center",
@@ -9578,7 +9814,7 @@ function template2columns(gobj, columns, template, sub_elements) {
9578
9814
  });
9579
9815
  Object.assign(column, {
9580
9816
  formatter: function(cell, formatterParams) {
9581
- return "<i style=\"\" class=\"yi-plus has-text-link\"></i>";
9817
+ return cell_icon("yi-plus has-text-link", "add");
9582
9818
  },
9583
9819
  hozAlign: "center",
9584
9820
  cellClick: function(evt, cell) {
@@ -9720,6 +9956,7 @@ function template2columns(gobj, columns, template, sub_elements) {
9720
9956
  * out-of-range number is more precise than anything generic here.
9721
9957
  ************************************************************/
9722
9958
  function field_validation_message($input) {
9959
+ if ($input.yui_json_error) return t($input.yui_json_error);
9723
9960
  let v = $input.validity;
9724
9961
  if (v && v.valueMissing) return t("this field is required");
9725
9962
  return $input.validationMessage;
@@ -9732,7 +9969,7 @@ function field_validation_message($input) {
9732
9969
  function mark_field_validity($input) {
9733
9970
  let $h = $input.parentNode ? $input.parentNode.querySelector(".help") : null;
9734
9971
  let v = $input.validity;
9735
- if (!v || v.valid) {
9972
+ if ((!v || v.valid) && !$input.yui_json_error) {
9736
9973
  $input.classList.remove("is-danger");
9737
9974
  if ($h) {
9738
9975
  $h.textContent = "";
@@ -9753,6 +9990,12 @@ function mark_field_validity($input) {
9753
9990
  function validate_form(gobj, $form) {
9754
9991
  let validated = true;
9755
9992
  if (!$form.checkValidity()) validated = false;
9993
+ $form.querySelectorAll(".jsoneditor.yui-form-data-input").forEach(($editor) => {
9994
+ if (!check_json_editor($editor)) {
9995
+ validated = false;
9996
+ mark_field_validity($editor);
9997
+ }
9998
+ });
9756
9999
  $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
9757
10000
  if (!$table.tabulator.validate()) validated = false;
9758
10001
  $table.querySelectorAll(".yui-tabulator-table-nested").forEach(($table_nested) => {
@@ -9762,6 +10005,22 @@ function validate_form(gobj, $form) {
9762
10005
  return validated;
9763
10006
  }
9764
10007
  /************************************************************
10008
+ * Does the jsoneditor `$editor` hold json its column can store?
10009
+ * Leaves the answer on the element (`yui_json_error`, an i18n key
10010
+ * or ""), where mark_field_validity() reads it.
10011
+ ************************************************************/
10012
+ function check_json_editor($editor) {
10013
+ let jsoneditor = $editor.jsoneditor;
10014
+ let field_desc = $editor.field_desc;
10015
+ if (!jsoneditor || !field_desc || $editor.hasAttribute("readonly")) {
10016
+ $editor.yui_json_error = "";
10017
+ return true;
10018
+ }
10019
+ let r = parse_json_field(json_editor_value(jsoneditor.get()), field_desc.type);
10020
+ $editor.yui_json_error = r.error;
10021
+ return !r.error;
10022
+ }
10023
+ /************************************************************
9765
10024
  * Function to get input value based on its type
9766
10025
  ************************************************************/
9767
10026
  function getInputValue($input) {
@@ -10119,23 +10378,23 @@ function treedb_value_2_form_value(gobj, field_desc, value) {
10119
10378
  return value;
10120
10379
  }
10121
10380
  /************************************************************
10381
+ * A json field's value, parsed. validate_form() refuses a field
10382
+ * that does not parse, so reaching the error here is a path that
10383
+ * skipped it: logged, never quiet.
10384
+ ************************************************************/
10385
+ function parse_json_value(gobj, field_desc, value) {
10386
+ let r = parse_json_field(value, field_desc.type);
10387
+ if (r.error) log_error(`${gobj_short_name(gobj)}: field '${field_desc.name}' (${field_desc.type}) holds no valid json, stored as empty`);
10388
+ return r.value;
10389
+ }
10390
+ /************************************************************
10122
10391
  * Convert from frontend to backend
10123
10392
  * operation: "create" "update"
10124
10393
  ************************************************************/
10125
10394
  function form_value_2_treedb_value(gobj, field_desc, value) {
10126
10395
  let type = field_desc.type;
10127
10396
  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
- }
10397
+ if (gobj_read_str_attr(gobj, "render_mode") === "edit" && (type === "template" || type === "table" || type === "coordinates")) return parse_json_value(gobj, field_desc, value);
10139
10398
  switch (type) {
10140
10399
  case "file": break;
10141
10400
  case "fkey":
@@ -10172,13 +10431,7 @@ function form_value_2_treedb_value(gobj, field_desc, value) {
10172
10431
  case "tel":
10173
10432
  case "svg": break;
10174
10433
  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 = {};
10434
+ value = parse_json_value(gobj, field_desc, value);
10182
10435
  break;
10183
10436
  case "table":
10184
10437
  case "id":
@@ -10195,13 +10448,7 @@ function form_value_2_treedb_value(gobj, field_desc, value) {
10195
10448
  case "dict": break;
10196
10449
  case "array":
10197
10450
  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 = [];
10451
+ value = parse_json_value(gobj, field_desc, value);
10205
10452
  break;
10206
10453
  case "real":
10207
10454
  value = parseFloat(value) || 0;
@@ -10210,12 +10457,7 @@ function form_value_2_treedb_value(gobj, field_desc, value) {
10210
10457
  value = parseBoolean(value);
10211
10458
  break;
10212
10459
  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 = {};
10460
+ value = parse_json_value(gobj, field_desc, value);
10219
10461
  break;
10220
10462
  case "number": break;
10221
10463
  case "coordinates":
@@ -10355,7 +10597,9 @@ function ac_add_table_row(gobj, event, kw, src) {
10355
10597
  }
10356
10598
  });
10357
10599
  }
10358
- }).catch(function(error) {});
10600
+ }).catch(function(error) {
10601
+ log_error(`${gobj_short_name(gobj)}: cannot add a table row: ${error}`);
10602
+ });
10359
10603
  setTimeout(function() {
10360
10604
  if ($row) {
10361
10605
  let $tabulator = $row.closest(".yui-tabulator-table");
@@ -10828,7 +11072,7 @@ function yui_maplibre_relocalize(map, t) {
10828
11072
  *
10829
11073
  * Map Manager
10830
11074
  *
10831
- * Copyright (c) 2025, ArtGins.
11075
+ * Copyright (c) 2025-2026, ArtGins.
10832
11076
  * All Rights Reserved.
10833
11077
  ***********************************************************************/
10834
11078
  /***************************************************************
@@ -10974,6 +11218,7 @@ function mt_start$16(gobj) {
10974
11218
  function mt_stop$16(gobj) {
10975
11219
  let shell = yui_shell_of(gobj);
10976
11220
  if (shell) gobj_unsubscribe_event(shell, "EV_LANGUAGE_CHANGED", {}, gobj);
11221
+ gobj_stop_children(gobj);
10977
11222
  return 0;
10978
11223
  }
10979
11224
  /***************************************************************
@@ -11263,52 +11508,24 @@ function find_device(gobj, id) {
11263
11508
  return null;
11264
11509
  }
11265
11510
  /************************************************************
11266
- * Event handler for click
11511
+ * Event handler for click: maplibre's callback only turns the
11512
+ * click into an event; the work is ac_marker_clicked().
11513
+ * Plain json: the marker's identity and where it is.
11267
11514
  ************************************************************/
11268
11515
  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);
11516
+ let feature = e && e.features && e.features[0];
11517
+ if (!feature) {
11518
+ log_error(`${gobj_name(gobj)}: marker click with no feature`);
11519
+ return;
11311
11520
  }
11521
+ let properties = feature.properties || {};
11522
+ let coordinates = feature.geometry.coordinates.slice();
11523
+ gobj_send_event(gobj, "EV_MARKER_CLICKED", {
11524
+ gobj_service_name: properties.gobj_service_name || "",
11525
+ name: properties.name !== void 0 ? String(properties.name) : "",
11526
+ id: properties.id !== void 0 ? String(properties.id) : "",
11527
+ coordinates
11528
+ }, gobj);
11312
11529
  }
11313
11530
  /************************************************************
11314
11531
  * Event handlers for dragging
@@ -11417,6 +11634,68 @@ function ac_refresh$7(gobj, event, kw, src) {
11417
11634
  return 0;
11418
11635
  }
11419
11636
  /************************************************************
11637
+ * EV_MARKER_CLICKED {gobj_service_name, name, id, coordinates}
11638
+ *
11639
+ * A marker backed by a gobj service opens that service's view in
11640
+ * a window -- ONE per marker: a second click is told to the open
11641
+ * one (EV_SHOW). (It created a second window under the same service
11642
+ * name, moved the one $container into it and left the first one
11643
+ * empty; closing the first then unregistered the second's name.)
11644
+ * A marker without a service gets a popup with its name and id.
11645
+ ************************************************************/
11646
+ function ac_marker_clicked(gobj, event, kw, src) {
11647
+ const map = gobj.priv.xmap;
11648
+ const gobj_service = kw.gobj_service_name ? gobj_find_service(kw.gobj_service_name, false) : null;
11649
+ if (gobj_service) {
11650
+ let window_service_name = `window-map-${clean_name(gobj_name(gobj_service))}`;
11651
+ let gobj_window = gobj_find_service(window_service_name, false);
11652
+ if (gobj_window) {
11653
+ gobj_send_event(gobj_window, "EV_SHOW", {}, gobj);
11654
+ return 0;
11655
+ }
11656
+ let popupContent = createElement2([
11657
+ "div",
11658
+ { class: "xmap columns m-0 p-0 is-flex-wrap-wrap" },
11659
+ gobj_read_attr(gobj_service, "$container")
11660
+ ]);
11661
+ gobj_window = gobj_create_service(window_service_name, "C_YUI_WINDOW", {
11662
+ $parent: document.getElementById("top-layer"),
11663
+ width: 700,
11664
+ height: 500,
11665
+ auto_save_size_and_position: false,
11666
+ center: true,
11667
+ showMax: false,
11668
+ content_size: true,
11669
+ title_prefix: gobj_name(gobj_service),
11670
+ title: "",
11671
+ icon: "yi-location-dot",
11672
+ logical_class: "MAP_MARKER_WINDOW",
11673
+ body: popupContent
11674
+ }, gobj);
11675
+ if (!gobj_window) {
11676
+ log_error(`${gobj_name(gobj)}: cannot create the marker window`);
11677
+ return -1;
11678
+ }
11679
+ gobj_start(gobj_window);
11680
+ return 0;
11681
+ }
11682
+ const popup = new maplibregl.Popup({
11683
+ closeButton: true,
11684
+ closeOnClick: true,
11685
+ closeOnMove: true,
11686
+ anchor: "center",
11687
+ maxWidth: "none"
11688
+ });
11689
+ let $content = document.createElement("div");
11690
+ let $name = document.createElement("b");
11691
+ $name.textContent = kw.name;
11692
+ $content.appendChild($name);
11693
+ $content.appendChild(document.createElement("br"));
11694
+ $content.appendChild(document.createTextNode(`Id: ${kw.id}`));
11695
+ popup.setLngLat(kw.coordinates).setDOMContent($content).addTo(map);
11696
+ return 0;
11697
+ }
11698
+ /************************************************************
11420
11699
  *
11421
11700
  ************************************************************/
11422
11701
  function ac_select(gobj, event, kw, src) {
@@ -11464,6 +11743,7 @@ function create_gclass$16(gclass_name) {
11464
11743
  ["EV_MAP_ON_LOAD", 0],
11465
11744
  ["EV_REFRESH", 0],
11466
11745
  ["EV_SELECT", 0],
11746
+ ["EV_MARKER_CLICKED", 0],
11467
11747
  ["EV_SHOW", 0],
11468
11748
  ["EV_HIDE", 0]
11469
11749
  ], [["ST_IDLE", [
@@ -11497,6 +11777,11 @@ function create_gclass$16(gclass_name) {
11497
11777
  ac_select,
11498
11778
  null
11499
11779
  ],
11780
+ [
11781
+ "EV_MARKER_CLICKED",
11782
+ ac_marker_clicked,
11783
+ null
11784
+ ],
11500
11785
  [
11501
11786
  "EV_SHOW",
11502
11787
  ac_show$11,
@@ -11663,7 +11948,7 @@ function build_ui$14(gobj) {
11663
11948
  class: "C_YUI_UPLOT",
11664
11949
  style: "overflow:auto;"
11665
11950
  }]);
11666
- gobj_write_bool_attr(gobj, "$container", $container);
11951
+ gobj_write_attr(gobj, "$container", $container);
11667
11952
  gobj_write_bool_attr(gobj, "own_container", true);
11668
11953
  }
11669
11954
  let uPlot_options = {
@@ -13025,7 +13310,7 @@ function ensure_drag_canvas_patch() {
13025
13310
  * Displays JSON data as a hierarchical graph visualization
13026
13311
  * Migrated from mx_json_viewer.js (mxGraph)
13027
13312
  *
13028
- * Copyright (c) 2025, ArtGins.
13313
+ * Copyright (c) 2025-2026, ArtGins.
13029
13314
  * All Rights Reserved.
13030
13315
  ***********************************************************************/
13031
13316
  /***************************************************************
@@ -13521,7 +13806,12 @@ function build_graph$4(gobj) {
13521
13806
  });
13522
13807
  if (priv.theme) graph.setTheme(priv.theme);
13523
13808
  graph.on(NodeEvent.CLICK, (evt) => {
13524
- gobj_send_event(gobj, "EV_NODE_CLICK", { evt }, gobj);
13809
+ let client = evt && evt.client ? evt.client : null;
13810
+ gobj_send_event(gobj, "EV_NODE_CLICK", {
13811
+ id: evt && evt.target && evt.target.id ? String(evt.target.id) : "",
13812
+ client_x: client && typeof client.x === "number" ? client.x : 0,
13813
+ client_y: client && typeof client.y === "number" ? client.y : 0
13814
+ }, gobj);
13525
13815
  });
13526
13816
  graph.on("aftertransform", () => {
13527
13817
  yui_graph_update_zoom(gobj_read_attr(gobj, "$container"), priv.graph);
@@ -14452,7 +14742,7 @@ function ac_center$4(gobj, event, kw, src) {
14452
14742
  function ac_node_click$4(gobj, event, kw, src) {
14453
14743
  let priv = gobj.priv;
14454
14744
  let graph = priv.graph;
14455
- let node_id = kw.evt.target.id;
14745
+ let node_id = kw.id;
14456
14746
  let nodedata;
14457
14747
  try {
14458
14748
  nodedata = graph.getNodeData(node_id);
@@ -18528,6 +18818,10 @@ function build_zone(gobj, zone) {
18528
18818
  {
18529
18819
  class: "GCLASS_ZONE_TOGGLE",
18530
18820
  type: "button",
18821
+ title: t(zone.key),
18822
+ "data-i18n-title": zone.key,
18823
+ "aria-label": t(zone.key),
18824
+ "data-i18n-aria-label": zone.key,
18531
18825
  "aria-expanded": collapsed ? "false" : "true"
18532
18826
  },
18533
18827
  [
@@ -18657,12 +18951,12 @@ function build_attrs(attrs) {
18657
18951
  [
18658
18952
  "td",
18659
18953
  { class: "GCLASS_CELL_DEFAULT" },
18660
- a.default_value
18954
+ document.createTextNode(String(a.default_value ?? ""))
18661
18955
  ],
18662
18956
  [
18663
18957
  "td",
18664
18958
  { class: "GCLASS_CELL_DESC" },
18665
- a.description
18959
+ document.createTextNode(String(a.description ?? ""))
18666
18960
  ]
18667
18961
  ]
18668
18962
  ];
@@ -20538,6 +20832,10 @@ function mt_destroy$9(gobj) {
20538
20832
  cancelAnimationFrame(priv._resize_raf);
20539
20833
  priv._resize_raf = 0;
20540
20834
  }
20835
+ if (priv.find_timer) {
20836
+ clearTimeout(priv.find_timer);
20837
+ priv.find_timer = null;
20838
+ }
20541
20839
  if (priv.graph) {
20542
20840
  priv.graph.destroy();
20543
20841
  priv.graph = null;
@@ -20944,7 +21242,12 @@ function build_graph$2(gobj) {
20944
21242
  save_view_state(gobj);
20945
21243
  });
20946
21244
  graph.on(NodeEvent.CLICK, (evt) => {
20947
- gobj_send_event(gobj, "EV_NODE_CLICK", { evt }, gobj);
21245
+ let client = evt && evt.client ? evt.client : null;
21246
+ gobj_send_event(gobj, "EV_NODE_CLICK", {
21247
+ id: evt && evt.target && evt.target.id ? String(evt.target.id) : "",
21248
+ client_x: client && typeof client.x === "number" ? client.x : 0,
21249
+ client_y: client && typeof client.y === "number" ? client.y : 0
21250
+ }, gobj);
20948
21251
  });
20949
21252
  graph.on(CanvasEvent.CLICK, (evt) => {
20950
21253
  hide_popover(gobj);
@@ -21956,7 +22259,7 @@ function ac_center$2(gobj, event, kw, src) {
21956
22259
  function ac_node_click$3(gobj, event, kw, src) {
21957
22260
  let priv = gobj.priv;
21958
22261
  let graph = priv.graph;
21959
- let node_id = kw.evt.target.id;
22262
+ let node_id = kw.id;
21960
22263
  let node_data = priv.node_by_id && priv.node_by_id[node_id] || null;
21961
22264
  if (!node_data) try {
21962
22265
  let nd = graph.getNodeData(node_id);
@@ -21972,8 +22275,8 @@ function ac_node_click$3(gobj, event, kw, src) {
21972
22275
  gobj_post_event(gobj, "EV_CENTER_ANCHOR", {}, gobj);
21973
22276
  return 0;
21974
22277
  }
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;
22278
+ let client_x = kw.client_x || 0;
22279
+ let client_y = kw.client_y || 0;
21977
22280
  show_popover(gobj, node_data, client_x, client_y);
21978
22281
  return 0;
21979
22282
  }
@@ -22624,7 +22927,7 @@ function is_decorative(it) {
22624
22927
  var attrs_table$7 = [
22625
22928
  SDATA(data_type_t.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
22626
22929
  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"),
22930
+ SDATA(data_type_t.DTP_STRING, "nav_label", 0, "", "i18n key of the label for aria/heading; falls back to 'navigation'"),
22628
22931
  SDATA(data_type_t.DTP_JSON, "menu_items", 0, null, "Array of menu items to render"),
22629
22932
  SDATA(data_type_t.DTP_STRING, "zone", 0, "", "Zone id where this nav lives"),
22630
22933
  SDATA(data_type_t.DTP_STRING, "layout", 0, "vertical", "vertical|icon-bar|tabs|drawer|submenu|accordion"),
@@ -22639,7 +22942,10 @@ var attrs_table$7 = [
22639
22942
  SDATA_END()
22640
22943
  ];
22641
22944
  var __nav_aria_seq__ = 0;
22642
- var PRIVATE_DATA$7 = { click_handler: null };
22945
+ var PRIVATE_DATA$7 = {
22946
+ click_handler: null,
22947
+ key_handler: null
22948
+ };
22643
22949
  var __gclass__$7 = null;
22644
22950
  /******************************
22645
22951
  * Framework Methods
@@ -22675,6 +22981,7 @@ function mt_destroy$7(gobj) {
22675
22981
  let $c = gobj_read_attr(gobj, "$container");
22676
22982
  let priv = gobj.priv;
22677
22983
  if ($c && priv && priv.click_handler) $c.removeEventListener("click", priv.click_handler);
22984
+ if ($c && priv && priv.key_handler) $c.removeEventListener("keydown", priv.key_handler);
22678
22985
  if ($c && $c.parentNode) $c.parentNode.removeChild($c);
22679
22986
  gobj_write_attr(gobj, "$container", null);
22680
22987
  }
@@ -22692,7 +22999,7 @@ function build_ui$7(gobj) {
22692
22999
  }
22693
23000
  let items = gobj_read_attr(gobj, "menu_items") || [];
22694
23001
  let zone = gobj_read_attr(gobj, "zone") || "";
22695
- let menu_id = gobj_read_attr(gobj, "menu_id") || "nav";
23002
+ gobj_read_attr(gobj, "menu_id");
22696
23003
  let $container;
22697
23004
  switch (layout) {
22698
23005
  case "vertical":
@@ -22736,8 +23043,9 @@ function build_ui$7(gobj) {
22736
23043
  if (layout !== "drawer") {
22737
23044
  $container.setAttribute("role", "navigation");
22738
23045
  if (!$container.hasAttribute("aria-label")) {
22739
- let label = gobj_read_attr(gobj, "nav_label") || menu_id;
22740
- $container.setAttribute("aria-label", label);
23046
+ let label = gobj_read_attr(gobj, "nav_label") || "navigation";
23047
+ $container.setAttribute("aria-label", t(label));
23048
+ $container.setAttribute("data-i18n-aria-label", label);
22741
23049
  }
22742
23050
  }
22743
23051
  wire_clicks(gobj, $container);
@@ -22756,6 +23064,7 @@ function rebuild(gobj) {
22756
23064
  let next = $old ? $old.nextSibling : null;
22757
23065
  let was_hidden = !!($old && $old.classList.contains("is-hidden"));
22758
23066
  if ($old && priv.click_handler) $old.removeEventListener("click", priv.click_handler);
23067
+ if ($old && priv.key_handler) $old.removeEventListener("keydown", priv.key_handler);
22759
23068
  build_ui$7(gobj);
22760
23069
  let $new = gobj_read_attr(gobj, "$container");
22761
23070
  if ($new && was_hidden) $new.classList.add("is-hidden");
@@ -22860,6 +23169,7 @@ function render_tabs(gobj, items) {
22860
23169
  class: "icon is-small yui-nav-close ml-2",
22861
23170
  "data-close-item": it.id,
22862
23171
  role: "button",
23172
+ tabindex: "0",
22863
23173
  "aria-label": t("close"),
22864
23174
  "data-i18n-aria-label": "close",
22865
23175
  title: t("close"),
@@ -22870,12 +23180,15 @@ function render_tabs(gobj, items) {
22870
23180
  "aria-hidden": "true"
22871
23181
  }]
22872
23182
  ]);
23183
+ let label = it.name || "";
22873
23184
  let a_attrs = {
22874
23185
  href: it.route ? "#" + it.route : "#",
22875
23186
  "data-item-id": it.id,
22876
- "data-route": it.route || ""
23187
+ "data-route": it.route || "",
23188
+ "aria-label": label || it.id
22877
23189
  };
22878
- let tip = it.tooltip || it.aria_label;
23190
+ if (label) a_attrs["data-i18n-aria-label"] = label;
23191
+ let tip = it.tooltip || it.aria_label || label;
22879
23192
  if (tip) {
22880
23193
  a_attrs.title = tip;
22881
23194
  a_attrs["data-i18n-title"] = tip;
@@ -23021,12 +23334,13 @@ function render_backbar(gobj) {
23021
23334
  ]);
23022
23335
  }
23023
23336
  function render_drawer(gobj, items) {
23024
- let menu_id = gobj_read_attr(gobj, "menu_id") || "drawer";
23025
23337
  let wrap = document.createElement("div");
23026
23338
  wrap.className = "yui-drawer";
23027
23339
  wrap.setAttribute("role", "dialog");
23028
23340
  wrap.setAttribute("aria-modal", "true");
23029
- wrap.setAttribute("aria-label", menu_id);
23341
+ let nav_label = gobj_read_attr(gobj, "nav_label") || "navigation";
23342
+ wrap.setAttribute("aria-label", t(nav_label));
23343
+ wrap.setAttribute("data-i18n-aria-label", nav_label);
23030
23344
  let back = document.createElement("div");
23031
23345
  back.className = "yui-drawer-backdrop";
23032
23346
  back.setAttribute("data-close-drawer", "1");
@@ -23034,7 +23348,8 @@ function render_drawer(gobj, items) {
23034
23348
  let panel = document.createElement("div");
23035
23349
  panel.className = "yui-drawer-panel";
23036
23350
  panel.setAttribute("role", "navigation");
23037
- panel.setAttribute("aria-label", menu_id);
23351
+ panel.setAttribute("aria-label", t(nav_label));
23352
+ panel.setAttribute("data-i18n-aria-label", nav_label);
23038
23353
  panel.appendChild(render_vertical(gobj, items));
23039
23354
  wrap.appendChild(back);
23040
23355
  wrap.appendChild(panel);
@@ -23088,7 +23403,13 @@ function render_accordion(gobj, items) {
23088
23403
  "aria-expanded": "false",
23089
23404
  "aria-controls": body_id
23090
23405
  };
23091
- if (!empty_string(head_text)) head_attrs.i18n = head_text;
23406
+ if (!empty_string(head_text)) {
23407
+ head_attrs.i18n = head_text;
23408
+ head_attrs.title = head_text;
23409
+ head_attrs["data-i18n-title"] = head_text;
23410
+ head_attrs["aria-label"] = head_text;
23411
+ head_attrs["data-i18n-aria-label"] = head_text;
23412
+ }
23092
23413
  let $hdr = createElement2([
23093
23414
  "button",
23094
23415
  head_attrs,
@@ -23174,7 +23495,7 @@ function item_li(gobj, it, opts) {
23174
23495
  "aria-label": aria_key
23175
23496
  };
23176
23497
  if (label) a_attrs["data-i18n-aria-label"] = label;
23177
- let tip = it.tooltip || it.aria_label;
23498
+ let tip = it.tooltip || it.aria_label || label;
23178
23499
  if (tip) {
23179
23500
  a_attrs.title = tip;
23180
23501
  a_attrs["data-i18n-title"] = tip;
@@ -23228,7 +23549,7 @@ function item_iconbar(gobj, it, opts) {
23228
23549
  "aria-label": label || it.id
23229
23550
  };
23230
23551
  if (label) a_attrs["data-i18n-aria-label"] = label;
23231
- let tip = it.tooltip || it.aria_label;
23552
+ let tip = it.tooltip || it.aria_label || label;
23232
23553
  if (tip) {
23233
23554
  a_attrs.title = tip;
23234
23555
  a_attrs["data-i18n-title"] = tip;
@@ -23296,6 +23617,14 @@ function wire_clicks(gobj, $container) {
23296
23617
  };
23297
23618
  $container.addEventListener("click", handler);
23298
23619
  priv.click_handler = handler;
23620
+ let key_handler = (ev) => {
23621
+ if (ev.key !== "Enter" && ev.key !== " ") return;
23622
+ let target = ev.target;
23623
+ if (!target || !target.closest || !target.closest("[data-close-item]")) return;
23624
+ handler(ev);
23625
+ };
23626
+ $container.addEventListener("keydown", key_handler);
23627
+ priv.key_handler = key_handler;
23299
23628
  }
23300
23629
  /***************************
23301
23630
  * Actions
@@ -23350,7 +23679,7 @@ function ac_route_changed(gobj, event, kw, src) {
23350
23679
  return 0;
23351
23680
  }
23352
23681
  function css_escape(s) {
23353
- return String(s).replace(/"/g, "\\\"");
23682
+ return String(s).replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
23354
23683
  }
23355
23684
  /***************************************************************
23356
23685
  * FSM
@@ -23570,6 +23899,8 @@ function build_body(shell, t) {
23570
23899
  type: "text",
23571
23900
  placeholder: t("filter", { defaultValue: "Filter…" }),
23572
23901
  "data-i18n-placeholder": "filter",
23902
+ title: t("filter", { defaultValue: "Filter" }),
23903
+ "data-i18n-title": "filter",
23573
23904
  "aria-label": t("filter", { defaultValue: "Filter" }),
23574
23905
  "data-i18n-aria-label": "filter"
23575
23906
  }]);
@@ -23657,6 +23988,10 @@ function build_body(shell, t) {
23657
23988
  "button",
23658
23989
  {
23659
23990
  class: "button is-small ROUTEMAP_PRINT",
23991
+ title: t("print", { defaultValue: "Print" }),
23992
+ "data-i18n-title": "print",
23993
+ "aria-label": t("print", { defaultValue: "Print" }),
23994
+ "data-i18n-aria-label": "print",
23660
23995
  i18n: "print"
23661
23996
  },
23662
23997
  t("print", { defaultValue: "Print" })
@@ -27197,46 +27532,46 @@ function yui_selection_bar(t, opts) {
27197
27532
  /***********************************************************************
27198
27533
  * yui_table_filter_clear.js
27199
27534
  *
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.
27535
+ * THE ✕ OF A TABULATOR'S HEADER FILTERS.
27536
+ *
27537
+ * A column filter is set by typing and removed by DELETING what
27538
+ * was typed, letter by letter, and nothing in the header says it
27539
+ * can be removed. With several columns filtered, getting the
27540
+ * whole table back is an exercise of memory: which ones did I
27541
+ * touch. The ✕ says it and does it.
27542
+ *
27543
+ * THREE DECISIONS THAT ARE NOT OBVIOUS:
27544
+ *
27545
+ * - **It shows while the filter has content, focused or not.**
27546
+ * The opposite of a form's ✕ (`yui_inputs.js`), which appears
27547
+ * only on the field being edited so as not to light a cross on
27548
+ * every filled field. Here the use case is the reverse: the
27549
+ * filter is already set, the focus is elsewhere, and what is
27550
+ * wanted is to see it and remove it. Hidden behind the focus it
27551
+ * would take two clicks.
27552
+ *
27553
+ * - **It clears through the API, not by faking keys.**
27554
+ * `setHeaderFilterValue(field, "")` is what Tabulator offers,
27555
+ * and it keeps the value and the filter consistent. Synthesising
27556
+ * an `input` on the `<input>` depends on what that filter's
27557
+ * editor listens to, which changes with the column type.
27558
+ *
27559
+ * - **The header is walked, the editor is not wrapped.** The
27560
+ * columns are built from the topic's schema, so there is no
27561
+ * single place to wrap the editor; and the header rebuilds
27562
+ * itself when the columns change. The walk is idempotent -- it
27563
+ * marks what already has its cross -- and is triggered by a
27564
+ * one-pass `querySelector`, so repeating it on every render
27565
+ * costs nothing.
27231
27566
  *
27232
27567
  * Copyright (c) 2026, ArtGins.
27233
27568
  * All Rights Reserved.
27234
27569
  ***********************************************************************/
27235
27570
  var MARK = "data-yui-filter-clear";
27236
27571
  /***************************************************************
27237
- * Pon (o repón) la ✕ de cada filtro de cabecera de `table`.
27572
+ * Put (or put back) the ✕ of every header filter of `table`.
27238
27573
  *
27239
- * Idempotente: los que ya la tienen se saltan.
27574
+ * Idempotent: the ones that already have it are skipped.
27240
27575
  ***************************************************************/
27241
27576
  function decorate(table) {
27242
27577
  if (!table || !table.element) return;
@@ -27274,11 +27609,11 @@ function decorate(table) {
27274
27609
  }
27275
27610
  }
27276
27611
  /***************************************************************
27277
- * Engancha la ✕ a una tabla ya creada.
27612
+ * Hook the ✕ onto a table already created.
27278
27613
  *
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.
27614
+ * Called once, with the table built. The hooks cover the two
27615
+ * moments the header appears or is rebuilt: when it is built
27616
+ * and when the columns change.
27282
27617
  ***************************************************************/
27283
27618
  function yui_table_filter_clear(table) {
27284
27619
  if (!table) return;
@@ -27928,6 +28263,7 @@ function mt_stop$5(gobj) {
27928
28263
  close_cell_file_dialog(gobj);
27929
28264
  close_hook_choice(gobj);
27930
28265
  drop_pending_assets(gobj);
28266
+ drop_pending_pages(gobj);
27931
28267
  table__destroy(gobj);
27932
28268
  }
27933
28269
  /***************************************************************
@@ -28847,6 +29183,7 @@ function create_tabulator(gobj) {
28847
29183
  else try {
28848
29184
  n = tabulator.getDataCount("active");
28849
29185
  } catch (e) {
29186
+ log_warning(`${gobj_short_name(gobj)}: cannot count the table's rows: ${e}`);
28850
29187
  n = 0;
28851
29188
  }
28852
29189
  let paged = gobj_read_bool_attr(gobj, "with_remote_paging");
@@ -29076,7 +29413,9 @@ function build_json_cell_preview(value) {
29076
29413
  {
29077
29414
  class: "JSON_CELL",
29078
29415
  title: t("show json"),
29079
- "data-i18n-title": "show json"
29416
+ "data-i18n-title": "show json",
29417
+ "aria-label": t("show json"),
29418
+ "data-i18n-aria-label": "show json"
29080
29419
  },
29081
29420
  [["span", { class: "JSON_CELL_ICON icon yi-eye" }], [
29082
29421
  "span",
@@ -30076,33 +30415,15 @@ function transform__form_value_2_treedb_value(gobj, col, value, operation) {
30076
30415
  case "object":
30077
30416
  case "dict":
30078
30417
  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
30418
  case "array":
30088
30419
  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
30420
  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 = {};
30421
+ case "blob": {
30422
+ let r = parse_json_field(value, field_desc.type);
30423
+ if (r.error) log_warning(`${gobj_short_name(gobj)}: column '${col.id}' (${field_desc.type}) holds no valid json, taken as empty`);
30424
+ value = r.value;
30105
30425
  break;
30426
+ }
30106
30427
  case "enum":
30107
30428
  switch (field_desc.real_type) {
30108
30429
  case "string":
@@ -31061,6 +31382,21 @@ function request_page(gobj, page, size) {
31061
31382
  });
31062
31383
  }
31063
31384
  /************************************************************
31385
+ * The view stops: no page request is waited for any more. Each
31386
+ * one's watchdog would otherwise fire EV_PAGE_TIMEOUT on a gobj
31387
+ * stopped -- or destroyed -- 20 s later.
31388
+ ************************************************************/
31389
+ function drop_pending_pages(gobj) {
31390
+ let priv = gobj.priv;
31391
+ let pending = priv._pending_pages || {};
31392
+ priv._pending_pages = {};
31393
+ for (let req_id of Object.keys(pending)) {
31394
+ let pend = pending[req_id];
31395
+ if (pend.timer) window.clearTimeout(pend.timer);
31396
+ pend.reject(/* @__PURE__ */ new Error("the view stopped"));
31397
+ }
31398
+ }
31399
+ /************************************************************
31064
31400
  * Settle a parked page request, however it ended.
31065
31401
  ************************************************************/
31066
31402
  function settle_page(gobj, req_id, value, error) {
@@ -63349,6 +63685,7 @@ function start_node_resize(gobj, e, mx, my) {
63349
63685
  function onPointerUp(ev) {
63350
63686
  document.removeEventListener("pointermove", onPointerMove);
63351
63687
  document.removeEventListener("pointerup", onPointerUp);
63688
+ document.removeEventListener("pointercancel", onPointerCancel);
63352
63689
  const dLeft = (currentRect.left - origVpRect.left) / zoom;
63353
63690
  const dTop = (currentRect.top - origVpRect.top) / zoom;
63354
63691
  const dRight = (currentRect.right - origVpRect.right) / zoom;
@@ -63382,8 +63719,15 @@ function start_node_resize(gobj, e, mx, my) {
63382
63719
  mark_graph_dirty(gobj);
63383
63720
  });
63384
63721
  }
63722
+ function onPointerCancel(ev) {
63723
+ document.removeEventListener("pointermove", onPointerMove);
63724
+ document.removeEventListener("pointerup", onPointerUp);
63725
+ document.removeEventListener("pointercancel", onPointerCancel);
63726
+ update_resize_handles_position(gobj);
63727
+ }
63385
63728
  document.addEventListener("pointermove", onPointerMove);
63386
63729
  document.addEventListener("pointerup", onPointerUp);
63730
+ document.addEventListener("pointercancel", onPointerCancel);
63387
63731
  }
63388
63732
  /************************************************************
63389
63733
  * Port selection and individual port resizing
@@ -63971,6 +64315,7 @@ function start_link_drag(gobj, e) {
63971
64315
  function onPointerUp(ev) {
63972
64316
  document.removeEventListener("pointermove", onPointerMove);
63973
64317
  document.removeEventListener("pointerup", onPointerUp);
64318
+ document.removeEventListener("pointercancel", onPointerCancel);
63974
64319
  priv.$container.style.cursor = "";
63975
64320
  if (priv._link_drag_svg) {
63976
64321
  priv._link_drag_svg.remove();
@@ -63984,8 +64329,20 @@ function start_link_drag(gobj, e) {
63984
64329
  if (target) try_complete_link(gobj, target.node_id, target.port_key);
63985
64330
  else exit_linking_mode(gobj);
63986
64331
  }
64332
+ function onPointerCancel(ev) {
64333
+ document.removeEventListener("pointermove", onPointerMove);
64334
+ document.removeEventListener("pointerup", onPointerUp);
64335
+ document.removeEventListener("pointercancel", onPointerCancel);
64336
+ priv.$container.style.cursor = "";
64337
+ if (priv._link_drag_svg) {
64338
+ priv._link_drag_svg.remove();
64339
+ priv._link_drag_svg = null;
64340
+ }
64341
+ exit_linking_mode(gobj);
64342
+ }
63987
64343
  document.addEventListener("pointermove", onPointerMove);
63988
64344
  document.addEventListener("pointerup", onPointerUp);
64345
+ document.addEventListener("pointercancel", onPointerCancel);
63989
64346
  }
63990
64347
  /************************************************************
63991
64348
  * Find if a canvas point hits a valid hook port during
@@ -64172,6 +64529,7 @@ function start_port_resize(gobj, e) {
64172
64529
  function onPointerUp(ev) {
64173
64530
  document.removeEventListener("pointermove", onPointerMove);
64174
64531
  document.removeEventListener("pointerup", onPointerUp);
64532
+ document.removeEventListener("pointercancel", onPointerCancel);
64175
64533
  const dx = ev.clientX - clientCx;
64176
64534
  const dy = ev.clientY - clientCy;
64177
64535
  let vpR = Math.max(PORT_HANDLE_SIZE, Math.sqrt(dx * dx + dy * dy));
@@ -64194,8 +64552,15 @@ function start_port_resize(gobj, e) {
64194
64552
  mark_graph_dirty(gobj);
64195
64553
  });
64196
64554
  }
64555
+ function onPointerCancel(ev) {
64556
+ document.removeEventListener("pointermove", onPointerMove);
64557
+ document.removeEventListener("pointerup", onPointerUp);
64558
+ document.removeEventListener("pointercancel", onPointerCancel);
64559
+ update_port_resize_handles_position(gobj);
64560
+ }
64197
64561
  document.addEventListener("pointermove", onPointerMove);
64198
64562
  document.addEventListener("pointerup", onPointerUp);
64563
+ document.addEventListener("pointercancel", onPointerCancel);
64199
64564
  }
64200
64565
  /************************************************************
64201
64566
  * Edge selection: show a floating properties icon near
@@ -72254,6 +72619,7 @@ var JSON_FIELDS$1 = [
72254
72619
  "properties",
72255
72620
  "pkey2s"
72256
72621
  ];
72622
+ var C_BACKSLASH = "\\\\";
72257
72623
  var JSON_BACKSLASH = "\\\\\\\\";
72258
72624
  var JSON_DQUOTE = "\\\\\\\"";
72259
72625
  var JSON_QUOTE = "\\\\u0027";
@@ -72359,7 +72725,19 @@ function c_scalar(value, key) {
72359
72725
  * themselves.
72360
72726
  ***************************************************************/
72361
72727
  function c_text(text) {
72362
- return text.replace(/\\/g, JSON_BACKSLASH).replace(/"/g, JSON_DQUOTE).replace(/'/g, JSON_QUOTE);
72728
+ return text.replace(/\\/g, JSON_BACKSLASH).replace(/"/g, JSON_DQUOTE).replace(/'/g, JSON_QUOTE).replace(/[\u0000-\u001f\u007f]/g, json_control);
72729
+ }
72730
+ var JSON_SHORT_ESCAPES = {
72731
+ "\n": "n",
72732
+ "\r": "r",
72733
+ " ": "t",
72734
+ "\b": "b",
72735
+ "\f": "f"
72736
+ };
72737
+ function json_control(ch) {
72738
+ let short = JSON_SHORT_ESCAPES[ch];
72739
+ if (short) return C_BACKSLASH + short;
72740
+ return "\\\\u" + ch.charCodeAt(0).toString(16).padStart(4, "0");
72363
72741
  }
72364
72742
  /***************************************************************
72365
72743
  * Render a value at `indent`, appending its lines to `lines`.
@@ -78680,16 +79058,19 @@ function build_ui(gobj) {
78680
79058
  gobj_write_attr(gobj, "$container", $container);
78681
79059
  }
78682
79060
  function build_mode_button(gobj, mode) {
79061
+ let name = mode_name(mode);
78683
79062
  let $btn = createElement2([
78684
79063
  "button",
78685
79064
  {
78686
79065
  class: `button YUI_PERIOD_MODE YUI_PERIOD_MODE_${mode.id.toUpperCase()}`,
78687
- type: "button"
79066
+ type: "button",
79067
+ title: name,
79068
+ "aria-label": name
78688
79069
  },
78689
79070
  [[
78690
79071
  "span",
78691
79072
  { class: "YUI_PERIOD_MODE_TEXT" },
78692
- mode_name(mode)
79073
+ name
78693
79074
  ]]
78694
79075
  ]);
78695
79076
  $btn.addEventListener("click", () => {
@@ -78711,16 +79092,19 @@ function build_more_menu(gobj) {
78711
79092
  ]);
78712
79093
  for (let mode of priv.modes) {
78713
79094
  if (!mode.overflow) continue;
79095
+ let name = mode_name(mode);
78714
79096
  let $item = createElement2([
78715
79097
  "a",
78716
79098
  {
78717
79099
  class: `dropdown-item YUI_PERIOD_MODE YUI_PERIOD_MODE_${mode.id.toUpperCase()}`,
78718
- href: "#"
79100
+ href: "#",
79101
+ title: name,
79102
+ "aria-label": name
78719
79103
  },
78720
79104
  [[
78721
79105
  "span",
78722
79106
  { class: "YUI_PERIOD_MODE_TEXT" },
78723
- mode_name(mode)
79107
+ name
78724
79108
  ]]
78725
79109
  ]);
78726
79110
  $item.addEventListener("click", (ev) => {
@@ -79018,7 +79402,11 @@ function render_calendar(gobj) {
79018
79402
  "button",
79019
79403
  {
79020
79404
  class: "button is-ghost mt-2 YUI_PERIOD_CAL_TODAY",
79021
- type: "button"
79405
+ type: "button",
79406
+ title: t("today"),
79407
+ "data-i18n-title": "today",
79408
+ "aria-label": t("today"),
79409
+ "data-i18n-aria-label": "today"
79022
79410
  },
79023
79411
  [[
79024
79412
  "span",
@@ -79346,8 +79734,11 @@ function ac_language_changed(gobj, event, kw, src) {
79346
79734
  let priv = gobj.priv;
79347
79735
  for (let mode of priv.modes) {
79348
79736
  if (!mode.$btn) continue;
79737
+ let name = mode_name(mode);
79349
79738
  let $text = mode.$btn.querySelector(".YUI_PERIOD_MODE_TEXT");
79350
- if ($text) $text.textContent = mode_name(mode);
79739
+ if ($text) $text.textContent = name;
79740
+ mode.$btn.setAttribute("title", name);
79741
+ mode.$btn.setAttribute("aria-label", name);
79351
79742
  }
79352
79743
  repaint(gobj);
79353
79744
  if (priv.$calendar) render_calendar(gobj);
@@ -80779,7 +81170,9 @@ function build_control_bar() {
80779
81170
  "data-dir": key,
80780
81171
  type: "button",
80781
81172
  title: t(title),
80782
- "data-i18n-title": title
81173
+ "data-i18n-title": title,
81174
+ "aria-label": t(title),
81175
+ "data-i18n-aria-label": title
80783
81176
  },
80784
81177
  glyph,
80785
81178
  { click: (ev) => {