@yuneta/gobj-ui 7.26.40 → 7.26.42

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 (39) hide show
  1. package/README.md +325 -65
  2. package/dist/gobj-ui.cjs.js +418 -176
  3. package/dist/gobj-ui.es.js +418 -176
  4. package/package.json +1 -1
  5. package/scripts/validate-locales.mjs +644 -142
  6. package/src/c_g6_nodes_tree.js +3 -2
  7. package/src/c_yui_form.js +80 -68
  8. package/src/c_yui_fsm_graph.js +3 -2
  9. package/src/c_yui_gobj_tree_js.js +3 -2
  10. package/src/c_yui_json_graph.js +3 -2
  11. package/src/c_yui_nav.js +43 -28
  12. package/src/c_yui_schema_editor.css +16 -0
  13. package/src/c_yui_schema_editor.js +61 -17
  14. package/src/c_yui_shell.js +199 -59
  15. package/src/c_yui_treedb_schema.js +3 -2
  16. package/src/c_yui_window_manager.js +6 -6
  17. package/src/form_table_edits_ask.wiring.test.js +398 -0
  18. package/src/form_table_rearm.wiring.test.js +9 -7
  19. package/src/g6_canvas_tab_order.css +29 -0
  20. package/src/g6_canvas_tab_order.js +41 -9
  21. package/src/g6_canvas_tab_order.wiring.test.js +107 -1
  22. package/src/i18n_key_functions.js +41 -25
  23. package/src/i18n_key_functions.test.js +178 -2
  24. package/src/modal_guard_back.wiring.test.js +135 -0
  25. package/src/named_controls.wiring.test.js +270 -6
  26. package/src/nav_cards_helpers.js +9 -4
  27. package/src/nav_item_badge.wiring.test.js +163 -15
  28. package/src/route_map_model.js +59 -10
  29. package/src/route_map_model.test.js +90 -0
  30. package/src/schema_editor_openers.wiring.test.js +283 -0
  31. package/src/shell_modals.js +24 -4
  32. package/src/shell_route_map.js +15 -3
  33. package/src/shell_section_index.js +3 -1
  34. package/src/window_layer.wiring.test.js +114 -0
  35. package/src/yui_gclass_view.js +16 -1
  36. package/src/yui_tabulator_i18n.js +21 -1
  37. package/src/yui_tabulator_i18n.test.js +39 -0
  38. package/src/yui_text.js +10 -0
  39. package/src/yui_text.test.js +13 -0
@@ -500,8 +500,16 @@ function text_node(value) {
500
500
  * Tabulator puts a STRING title in with innerHTML, so a title taken
501
501
  * from a schema (`header`, which the schema editor writes) is markup
502
502
  * unless the column carries a formatter that returns a Node.
503
+ *
504
+ * And it APPENDS that Node to the title's holder, which it never
505
+ * empties -- while it runs the formatter again on every setLocale()
506
+ * (yui_tabulator_relocalize()). Until 7.26.40 each change of language
507
+ * added one more copy of every title ("Id dispositivoId dispositivo").
508
+ * The holder (the mock cell's element) is emptied first.
503
509
  ************************************************************/
504
510
  function text_title_formatter(cell) {
511
+ const $holder = typeof cell.getElement === "function" ? cell.getElement() : null;
512
+ if ($holder) $holder.textContent = "";
505
513
  return text_node(cell.getValue());
506
514
  }
507
515
  /************************************************************
@@ -696,12 +704,42 @@ function paint_badge($badge, value, tone) {
696
704
  * All Rights Reserved.
697
705
  ***********************************************************************/
698
706
  /************************************************************
707
+ * The label of a row is the name of its CONTROL: one rule names
708
+ * an item everywhere.
709
+ *
710
+ * - A menu entry, as the nav names it (c_yui_nav.js item_li):
711
+ * its `name`, else its `aria_label`, else its id.
712
+ * - A toolbar item and a row of its dropdown, as the toolbar
713
+ * names them (c_yui_shell.js build_toolbar_*): its
714
+ * `aria_label` first -- the visible `name` of a toolbar
715
+ * button is often a symbol ("ES/EN") --, then its `name`,
716
+ * then, for an avatar or a connection dot, the library's own
717
+ * key, else its id.
718
+ *
719
+ * A route is no key: it has its own column, and an item with
720
+ * none of these has no label. Up to 7.26.41 a row was labelled
721
+ * `name || wordmark || id || route` -- an entry that declares
722
+ * only an `aria_label` had its id here, the language button read
723
+ * "ES/EN" where its control says "toggle language", and a route
724
+ * was asked of the locales as a key.
725
+ ************************************************************/
726
+ function menu_item_label(it) {
727
+ return it.name || it.aria_label || it.id || "";
728
+ }
729
+ function toolbar_item_label(it) {
730
+ let fallback = it.id || "";
731
+ if (it.type === "avatar") fallback = "user menu";
732
+ else if (it.type === "connection") fallback = "backend connection";
733
+ return it.aria_label || it.name || fallback;
734
+ }
735
+ /************************************************************
699
736
  * One node of the nav map from a declared config item, in
700
737
  * DECLARATION ORDER (never sorted). Recurses into static submenus
701
738
  * and toolbar dropdowns, and merges the LIVE dynamic submenu tabs
702
739
  * (added at runtime via yui_shell_set_submenu) by parent id.
740
+ * `label_of` names it: menu_item_label() or toolbar_item_label().
703
741
  ************************************************************/
704
- function nav_node_from_item(it, index) {
742
+ function nav_node_from_item(it, index, label_of) {
705
743
  if (!it || it.type === "divider" || it.type === "header") return null;
706
744
  let action = it.action || {};
707
745
  let route = it.route || (action.type === "navigate" ? action.route : "") || "";
@@ -714,7 +752,7 @@ function nav_node_from_item(it, index) {
714
752
  }
715
753
  let node = {
716
754
  id: it.id || "",
717
- label: it.name || it.wordmark || it.id || route || "",
755
+ label: label_of(it),
718
756
  icon: it.icon || "",
719
757
  route,
720
758
  event,
@@ -724,14 +762,14 @@ function nav_node_from_item(it, index) {
724
762
  };
725
763
  let sub_items = it.submenu && Array.isArray(it.submenu.items) ? it.submenu.items : action.type === "dropdown" && Array.isArray(action.items) ? action.items : null;
726
764
  if (sub_items) for (let s of sub_items) {
727
- let n = nav_node_from_item(s, index);
765
+ let n = nav_node_from_item(s, index, label_of);
728
766
  if (n) node.children.push(n);
729
767
  }
730
768
  if (it.id && index) for (let r of Object.keys(index)) {
731
769
  let e = index[r];
732
770
  if (e && e.parent_item && e.parent_item.id === it.id && !node.children.some((c) => c.route === r)) node.children.push({
733
771
  id: e.item && e.item.id || "",
734
- label: e.item && e.item.name || r,
772
+ label: e.item ? menu_item_label(e.item) : "",
735
773
  icon: e.item && e.item.icon || "",
736
774
  route: r,
737
775
  event: "",
@@ -847,7 +885,10 @@ function mark_current(groups, current_route) {
847
885
  *
848
886
  * - `nav` walks EVERY declared menu in declaration order: the
849
887
  * `primary` menu contributes its items flat (the common case);
850
- * any other menu contributes a group node labelled by its key.
888
+ * any other menu contributes a group node labelled by its key,
889
+ * as data (`data_label: true`).
890
+ * - a node is labelled as its control is named (menu_item_label(),
891
+ * toolbar_item_label()); a node no item names has label "".
851
892
  * - `other` lists the routes declared only in the route table
852
893
  * (config.shell.routes) that no rendered node covers — root "/",
853
894
  * URL-only action routes, toolbar-less forms. Brand-covered
@@ -882,7 +923,7 @@ function build_nav_map(input) {
882
923
  };
883
924
  continue;
884
925
  }
885
- let n = nav_node_from_item(it, index);
926
+ let n = nav_node_from_item(it, index, toolbar_item_label);
886
927
  if (n) toolbar.push(n);
887
928
  }
888
929
  let nav = [];
@@ -892,13 +933,14 @@ function build_nav_map(input) {
892
933
  if (!m || !Array.isArray(m.items)) continue;
893
934
  let nodes = [];
894
935
  for (let it of m.items) {
895
- let n = nav_node_from_item(it, index);
936
+ let n = nav_node_from_item(it, index, menu_item_label);
896
937
  if (n) nodes.push(n);
897
938
  }
898
939
  if (menu_id === "primary") nav = nav.concat(nodes);
899
940
  else if (nodes.length) nav.push({
900
941
  id: menu_id,
901
942
  label: menu_id,
943
+ data_label: true,
902
944
  icon: "",
903
945
  route: "",
904
946
  event: "",
@@ -925,7 +967,7 @@ function build_nav_map(input) {
925
967
  let tgt = e && e.target || null;
926
968
  other.push({
927
969
  id: e && e.item && e.item.id || "",
928
- label: e && e.item && (e.item.name || e.item.id) || r,
970
+ label: e && e.item ? menu_item_label(e.item) : "",
929
971
  icon: e && e.item && e.item.icon || "",
930
972
  route: r,
931
973
  event: tgt && tgt.kind === "action" && tgt.event || "",
@@ -1005,7 +1047,7 @@ function section_index_target(menu_id, item) {
1005
1047
  gclass: "C_YUI_NAV",
1006
1048
  kw: {
1007
1049
  menu_id: `index.${menu_id}.${item.id}`,
1008
- nav_label: item.name || item.id || "",
1050
+ nav_label: item.name || item.aria_label || item.id || "",
1009
1051
  menu_items: sub.items,
1010
1052
  layout: "cards",
1011
1053
  level: "secondary"
@@ -1077,7 +1119,7 @@ function secondary_nav_renders(item, layout) {
1077
1119
  * Constants
1078
1120
  ***************************************************************/
1079
1121
  var GCLASS_NAME$22 = "C_YUI_SHELL";
1080
- var __last_shell__ = null;
1122
+ var __live_shells__ = [];
1081
1123
  var __shell_watchers__ = [];
1082
1124
  var __window_z__ = 10;
1083
1125
  var ZONE_IDS = [
@@ -1120,6 +1162,8 @@ var PRIVATE_DATA$22 = {
1120
1162
  item_index: {},
1121
1163
  nav_badges: {},
1122
1164
  badge_status: null,
1165
+ badge_news: [],
1166
+ badge_news_closing: false,
1123
1167
  dynamic_items: {},
1124
1168
  section_pos: {},
1125
1169
  route_mru: [],
@@ -1158,7 +1202,7 @@ var __gclass__$22 = null;
1158
1202
  function mt_create$22(gobj) {
1159
1203
  const subscriber = gobj_read_pointer_attr(gobj, "subscriber");
1160
1204
  if (subscriber) gobj_subscribe_event(gobj, null, {}, subscriber);
1161
- __last_shell__ = gobj;
1205
+ __live_shells__.push(gobj);
1162
1206
  build_ui$19(gobj);
1163
1207
  tell_shell_watchers(gobj);
1164
1208
  }
@@ -1344,7 +1388,8 @@ function mt_stop$20(gobj) {
1344
1388
  ***************************************************************/
1345
1389
  function mt_destroy$22(gobj) {
1346
1390
  close_toolbar_dropdown(gobj);
1347
- if (__last_shell__ === gobj) __last_shell__ = null;
1391
+ let live_idx = __live_shells__.indexOf(gobj);
1392
+ if (live_idx >= 0) __live_shells__.splice(live_idx, 1);
1348
1393
  let $container = gobj_read_attr(gobj, "$container");
1349
1394
  if ($container && $container.parentNode) $container.parentNode.removeChild($container);
1350
1395
  tell_shell_watchers(gobj);
@@ -1727,7 +1772,7 @@ function instantiate_menus(gobj, config) {
1727
1772
  let nav = instantiate_nav_in_zone(gobj, {
1728
1773
  items: sub.items,
1729
1774
  render: { [zone_id]: render_cfg }
1730
- }, sub_menu_id, zone_id, "secondary", item.name || "");
1775
+ }, sub_menu_id, zone_id, "secondary", item.name || item.aria_label || item.id || "");
1731
1776
  let $c = gobj_read_attr(nav, "$container");
1732
1777
  if ($c) $c.classList.add("is-hidden");
1733
1778
  }
@@ -2095,25 +2140,24 @@ function build_toolbar_action_item(gobj, it) {
2095
2140
  },
2096
2141
  text_node(it.name)
2097
2142
  ]);
2098
- let aria_key = it.aria_label || it.name || it.id || "";
2099
- let i18n_aria = it.aria_label || it.name;
2143
+ let name_key = it.aria_label || it.name || it.id || "";
2100
2144
  let btn_attrs = {
2101
2145
  class: "navbar-item yui-toolbar-item is-unselectable",
2102
2146
  type: "button",
2103
2147
  "data-toolbar-item-id": it.id || "",
2104
- "aria-label": aria_key
2148
+ "aria-label": name_key
2105
2149
  };
2106
- if (i18n_aria) btn_attrs["data-i18n-aria-label"] = i18n_aria;
2150
+ if (name_key) btn_attrs["data-i18n-aria-label"] = name_key;
2107
2151
  if ((it.action && it.action.type || "") === "dropdown") {
2108
2152
  btn_attrs["aria-haspopup"] = "menu";
2109
2153
  btn_attrs["aria-expanded"] = "false";
2110
2154
  }
2111
- let tip = it.tooltip || i18n_aria;
2155
+ let tip = it.tooltip || name_key;
2112
2156
  if (tip) {
2113
2157
  btn_attrs.title = tip;
2114
2158
  btn_attrs["data-i18n-title"] = tip;
2115
2159
  }
2116
- if (badge && !empty_string(aria_key)) name_control_with_badge(btn_attrs, badge);
2160
+ if (badge && !empty_string(name_key)) name_control_with_badge(btn_attrs, badge);
2117
2161
  let link = toolbar_link_attrs(it);
2118
2162
  if (link) {
2119
2163
  delete btn_attrs.type;
@@ -2197,21 +2241,20 @@ function build_toolbar_brand_item(gobj, it) {
2197
2241
  ************************************************************/
2198
2242
  function build_toolbar_avatar_item(gobj, it) {
2199
2243
  let priv = gobj.priv;
2200
- const aria_key = it.aria_label || it.name || it.id || "user menu";
2201
- const i18n_aria = it.aria_label || it.name || "user menu";
2244
+ const name_key = it.aria_label || it.name || "user menu";
2202
2245
  let action_type = it.action && it.action.type || "";
2203
2246
  let attrs = {
2204
2247
  class: "navbar-item yui-toolbar-item yui-toolbar-avatar is-unselectable",
2205
2248
  type: "button",
2206
2249
  "data-toolbar-item-id": it.id || "",
2207
- "aria-label": aria_key,
2208
- "data-i18n-aria-label": i18n_aria
2250
+ "aria-label": name_key,
2251
+ "data-i18n-aria-label": name_key
2209
2252
  };
2210
2253
  if (action_type === "dropdown") {
2211
2254
  attrs["aria-haspopup"] = "menu";
2212
2255
  attrs["aria-expanded"] = "false";
2213
2256
  }
2214
- let tip = it.tooltip || i18n_aria;
2257
+ let tip = it.tooltip || name_key;
2215
2258
  if (tip) {
2216
2259
  attrs.title = tip;
2217
2260
  attrs["data-i18n-title"] = tip;
@@ -2274,16 +2317,15 @@ function attach_context_action(gobj, $item, it) {
2274
2317
  ************************************************************/
2275
2318
  function build_toolbar_connection_item(gobj, it) {
2276
2319
  let priv = gobj.priv;
2277
- const aria_key = it.aria_label || it.name || it.id || "backend connection";
2278
- const i18n_aria = it.aria_label || it.name || "backend connection";
2320
+ const name_key = it.aria_label || it.name || "backend connection";
2279
2321
  let attrs = {
2280
2322
  class: "navbar-item yui-toolbar-item yui-toolbar-conn is-unselectable is-disconnected",
2281
2323
  type: "button",
2282
2324
  "data-toolbar-item-id": it.id || "",
2283
- "aria-label": aria_key,
2284
- "data-i18n-aria-label": i18n_aria
2325
+ "aria-label": name_key,
2326
+ "data-i18n-aria-label": name_key
2285
2327
  };
2286
- let tip = it.tooltip || i18n_aria;
2328
+ let tip = it.tooltip || name_key;
2287
2329
  if (tip) {
2288
2330
  attrs.title = tip;
2289
2331
  attrs["data-i18n-title"] = tip;
@@ -2381,13 +2423,12 @@ function toggle_toolbar_dropdown(gobj, item, action, $trigger) {
2381
2423
  function open_toolbar_dropdown(gobj, item, action, $trigger) {
2382
2424
  let priv = gobj.priv;
2383
2425
  if (!priv || !priv.layers || !priv.layers.popup) return;
2384
- const aria_key = item && (item.aria_label || item.name || item.id) || "menu";
2385
- const i18n_aria = item && (item.aria_label || item.name) || "menu";
2426
+ const name_key = item && (item.aria_label || item.name || (classify_toolbar_item(item) === "avatar" ? "user menu" : item.id)) || "menu";
2386
2427
  let $panel = createElement2(["div", {
2387
2428
  class: "yui-toolbar-dropdown-panel",
2388
2429
  role: "menu",
2389
- "aria-label": aria_key,
2390
- "data-i18n-aria-label": i18n_aria,
2430
+ "aria-label": name_key,
2431
+ "data-i18n-aria-label": name_key,
2391
2432
  "data-toolbar-dropdown-for": item && item.id || ""
2392
2433
  }]);
2393
2434
  let raw_items = is_array(action.items) ? action.items : [];
@@ -2520,20 +2561,19 @@ function build_dropdown_row(gobj, sub, idx) {
2520
2561
  "aria-hidden": "true"
2521
2562
  }]
2522
2563
  ]);
2523
- let aria_key = sub.aria_label || sub.name || sub.id || "";
2524
- let i18n_aria = sub.aria_label || sub.name;
2564
+ let name_key = sub.aria_label || sub.name || sub.id || "";
2525
2565
  let attrs = {
2526
2566
  class: "yui-toolbar-dropdown-item" + (sub.selected ? " is-selected" : ""),
2527
2567
  type: "button",
2528
2568
  role: "menuitemradio",
2529
2569
  "aria-checked": sub.selected ? "true" : "false",
2530
2570
  "data-dropdown-item-id": sub.id || "",
2531
- "aria-label": aria_key
2571
+ "aria-label": name_key
2532
2572
  };
2533
- if (i18n_aria) {
2534
- attrs["data-i18n-aria-label"] = i18n_aria;
2535
- attrs.title = i18n_aria;
2536
- attrs["data-i18n-title"] = i18n_aria;
2573
+ if (name_key) {
2574
+ attrs["data-i18n-aria-label"] = name_key;
2575
+ attrs.title = name_key;
2576
+ attrs["data-i18n-title"] = name_key;
2537
2577
  }
2538
2578
  let $btn = createElement2([
2539
2579
  "button",
@@ -2955,11 +2995,23 @@ function shell_navs(gobj) {
2955
2995
  * `name_key` is the key of the control's name; the phrase is a
2956
2996
  * key of its own, so a language orders and punctuates it its
2957
2997
  * way. Said once: a live region needs no re-translation.
2958
- ************************************************************/
2959
- function announce_badge(gobj, name_key, text) {
2960
- let priv = gobj.priv;
2961
- let $status = priv.badge_status;
2962
- if (!$status) {
2998
+ *
2999
+ * `source` names the badge ("toolbar:<id>", "nav:<id>"). Every
3000
+ * change of ONE turn of the loop is said in ONE message, a line
3001
+ * of the region each, in the order they came; a badge that moves
3002
+ * twice in the turn says its last count. Up to 7.26.41 each
3003
+ * change replaced the region's text, and a reader hears the
3004
+ * region as it is when the turn is over: of two changes in one
3005
+ * action (a feed that updates the toolbar's count and the menu
3006
+ * entry's, which is what a count is for) only the second was
3007
+ * ever said. The turn is closed by EV_CLOSE_BADGE_NEWS, posted to
3008
+ * the shell by its first change: gobj_post_event() delivers it on
3009
+ * the next turn, through the machine -- a deferral, not a time.
3010
+ ************************************************************/
3011
+ function announce_badge(gobj, name_key, text, source) {
3012
+ let priv = gobj.priv;
3013
+ if (gobj_is_destroying(gobj)) return;
3014
+ if (!priv.badge_status) {
2963
3015
  log_error(`C_YUI_SHELL: no live region to say badge '${name_key}': ${text}`);
2964
3016
  return;
2965
3017
  }
@@ -2968,10 +3020,60 @@ function announce_badge(gobj, name_key, text) {
2968
3020
  const tr = priv.translator;
2969
3021
  message = tr("{{name}}, {{n}}", {
2970
3022
  name: tr(name_key),
2971
- n: text
3023
+ n: text,
3024
+ interpolation: { escapeValue: false }
2972
3025
  });
2973
3026
  } else message = `${name_key}, ${text}`;
2974
- $status.textContent = message;
3027
+ let news = priv.badge_news.find((n) => n.source === source);
3028
+ if (news) news.message = message;
3029
+ else priv.badge_news.push({
3030
+ source,
3031
+ message
3032
+ });
3033
+ write_badge_news(gobj);
3034
+ if (priv.badge_news_closing) return;
3035
+ if (gobj_post_event(gobj, "EV_CLOSE_BADGE_NEWS", {}, gobj) < 0) {
3036
+ priv.badge_news = [];
3037
+ return;
3038
+ }
3039
+ priv.badge_news_closing = true;
3040
+ }
3041
+ /************************************************************
3042
+ * A badge whose count went away in the turn it changed: what
3043
+ * this turn said of it is no news any more -- the badge shows
3044
+ * nothing -- and is taken out of the message.
3045
+ ************************************************************/
3046
+ function forget_badge_news(gobj, source) {
3047
+ let priv = gobj.priv;
3048
+ let idx = priv.badge_news.findIndex((n) => n.source === source);
3049
+ if (idx < 0) return;
3050
+ priv.badge_news.splice(idx, 1);
3051
+ write_badge_news(gobj);
3052
+ }
3053
+ /************************************************************
3054
+ * The live region holds the message of this turn: a line per
3055
+ * change, so a reader separates them without a punctuation of
3056
+ * ours, and two controls of one name with one count say it once.
3057
+ *
3058
+ * Written whole, and with new nodes, even when it reads the same:
3059
+ * the callers filter what is no news, and a count that went away
3060
+ * and came back IS news -- a new text node is a change a reader
3061
+ * announces.
3062
+ ************************************************************/
3063
+ function write_badge_news(gobj) {
3064
+ let priv = gobj.priv;
3065
+ let said = [];
3066
+ let $lines = [];
3067
+ for (let news of priv.badge_news) {
3068
+ if (said.includes(news.message)) continue;
3069
+ said.push(news.message);
3070
+ $lines.push(createElement2([
3071
+ "div",
3072
+ { class: "SHELL_BADGE_NEWS" },
3073
+ text_node(news.message)
3074
+ ]));
3075
+ }
3076
+ priv.badge_status.replaceChildren(...$lines);
2975
3077
  }
2976
3078
  /************************************************************
2977
3079
  * A shell was built (mt_create) or is being destroyed
@@ -3044,6 +3146,19 @@ function ac_back_wait_timeout(gobj, event, kw, src) {
3044
3146
  return 0;
3045
3147
  }
3046
3148
  /************************************************************
3149
+ * The turn in which badges changed is over (posted by the first
3150
+ * change, announce_badge()): the message in the live region is
3151
+ * complete, and a reader hears it as it stands. The next change
3152
+ * starts a message of its own -- added to this one, it would say
3153
+ * again what was already said.
3154
+ ************************************************************/
3155
+ function ac_close_badge_news(gobj, event, kw, src) {
3156
+ let priv = gobj.priv;
3157
+ priv.badge_news = [];
3158
+ priv.badge_news_closing = false;
3159
+ return 0;
3160
+ }
3161
+ /************************************************************
3047
3162
  * Drawer backdrop click on a C_YUI_NAV child: the nav publishes
3048
3163
  * this so the shell can close the drawer through the canonical
3049
3164
  * flow (DOM + focus-trap + escape-stack pop) instead of mutating
@@ -3121,12 +3236,18 @@ function create_gclass$22(gclass_name) {
3121
3236
  "EV_BACK_WAIT_TIMEOUT",
3122
3237
  ac_back_wait_timeout,
3123
3238
  null
3239
+ ],
3240
+ [
3241
+ "EV_CLOSE_BADGE_NEWS",
3242
+ ac_close_badge_news,
3243
+ null
3124
3244
  ]
3125
3245
  ]]];
3126
3246
  const event_types = [
3127
3247
  ["EV_NAV_CLICKED", 0],
3128
3248
  ["EV_DRAWER_CLOSE_REQUESTED", 0],
3129
3249
  ["EV_BACK_WAIT_TIMEOUT", 0],
3250
+ ["EV_CLOSE_BADGE_NEWS", 0],
3130
3251
  ["EV_NAV_ITEM_CLOSE", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_PUBLIC_EVENT | event_flag_t.EVF_NO_WARN_SUBS],
3131
3252
  ["EV_ROUTE_REQUESTED", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_PUBLIC_EVENT | event_flag_t.EVF_NO_WARN_SUBS],
3132
3253
  ["EV_ROUTE_CHANGED", event_flag_t.EVF_OUTPUT_EVENT | event_flag_t.EVF_PUBLIC_EVENT | event_flag_t.EVF_NO_WARN_SUBS],
@@ -3252,9 +3373,9 @@ function yui_shell_previous_route(shell_gobj) {
3252
3373
  /************************************************************
3253
3374
  * Resolve the shell that governs `gobj`: the nearest
3254
3375
  * C_YUI_SHELL ancestor, else the last shell created on the
3255
- * page (apps have exactly one). Null when no shell exists —
3256
- * callers must degrade loudly (shell_modals logs a warning
3257
- * and resolves the safe default).
3376
+ * page that is still alive (apps have exactly one). Null when
3377
+ * no shell exists — callers must degrade loudly (shell_modals
3378
+ * logs a warning and resolves the safe default).
3258
3379
  ************************************************************/
3259
3380
  function yui_shell_of(gobj) {
3260
3381
  let g = gobj;
@@ -3262,7 +3383,7 @@ function yui_shell_of(gobj) {
3262
3383
  if (gobj_gclass_name(g) === GCLASS_NAME$22) return g;
3263
3384
  g = gobj_parent(g);
3264
3385
  }
3265
- return __last_shell__;
3386
+ return __live_shells__.length > 0 ? __live_shells__[__live_shells__.length - 1] : null;
3266
3387
  }
3267
3388
  /************************************************************
3268
3389
  * The DOM where a C_YUI_WINDOW lives when its host names no
@@ -3600,8 +3721,8 @@ function yui_shell_set_toolbar_item_badge(shell_gobj, item_id, value, tone) {
3600
3721
  let now = badge_text(value);
3601
3722
  if (now && now !== before) {
3602
3723
  let $item = $badge.closest("[data-toolbar-item-id]");
3603
- announce_badge(shell_gobj, $item && $item.getAttribute("data-i18n-aria-label") || item_id, now);
3604
- }
3724
+ announce_badge(shell_gobj, $item && $item.getAttribute("data-i18n-aria-label") || item_id, now, `toolbar:${item_id}`);
3725
+ } else if (!now) forget_badge_news(shell_gobj, `toolbar:${item_id}`);
3605
3726
  }
3606
3727
  /************************************************************
3607
3728
  * Set (or clear) the badge of a MENU item — the twin of
@@ -3650,7 +3771,8 @@ function yui_shell_set_nav_item_badge(shell_gobj, item_id, value, tone) {
3650
3771
  badge_tone: tone
3651
3772
  }, shell_gobj);
3652
3773
  let now = badge_text(badge);
3653
- if (now && now !== before) announce_badge(shell_gobj, item.name || item_id, now);
3774
+ if (now && now !== before) announce_badge(shell_gobj, item.name || item.aria_label || item_id, now, `nav:${item_id}`);
3775
+ else if (!now) forget_badge_news(shell_gobj, `nav:${item_id}`);
3654
3776
  }
3655
3777
  /************************************************************
3656
3778
  * Programmatic close of any open toolbar dropdown. Useful for
@@ -3966,7 +4088,19 @@ function yui_shell_show_modal(shell, content, opts) {
3966
4088
  allow = true;
3967
4089
  }
3968
4090
  if (allow && typeof allow.then === "function") {
3969
- if (typeof on_veto === "function") allow.then(on_veto, on_veto);
4091
+ let vetoed = function() {
4092
+ if (typeof on_veto === "function") on_veto();
4093
+ };
4094
+ allow.then(function(answer) {
4095
+ if (answer === true) {
4096
+ do_close();
4097
+ return;
4098
+ }
4099
+ vetoed();
4100
+ }, function(e) {
4101
+ log_warning(`yui_shell_show_modal: before_close rejected: ${e}`);
4102
+ vetoed();
4103
+ });
3970
4104
  return;
3971
4105
  }
3972
4106
  if (allow === false) {
@@ -5568,12 +5702,12 @@ function apply_placement(gobj) {
5568
5702
  * and it covered a toast where they met.
5569
5703
  *
5570
5704
  * The popup layer, not the window layer: the dock has to stay
5571
- * above EVERY window, and windows live in two layers -- the
5572
- * window layer (no `$parent`) and the popup layer, where the
5573
- * site map and the JSON windows of the treedb views put theirs.
5574
- * Above both; below the dialogs, the toasts and the loading
5575
- * cover. No shell (before the first, between a logout and the
5576
- * next login): the body.
5705
+ * above EVERY window, and the windows live in the window layer
5706
+ * -- since 7.26.35 the site map and the JSON windows of the
5707
+ * treedb views too, which put theirs in the popup layer until
5708
+ * then. The popup layer is above it; below the dialogs, the
5709
+ * toasts and the loading cover. No shell (before the first,
5710
+ * between a logout and the next login): the body.
5577
5711
  ************************************************************/
5578
5712
  function dock_place(gobj) {
5579
5713
  return yui_shell_popup_layer(yui_shell_of(gobj)) || document.body;
@@ -7101,6 +7235,12 @@ function register_c_yui_wizard() {
7101
7235
  * new Tabulator($el, {..., ...yui_tabulator_lang(t)});
7102
7236
  * yui_tabulator_relocalize(table, t); // on a language change
7103
7237
  *
7238
+ * A view whose COLUMN TITLES change language hands them too, in the
7239
+ * new language, by field -- Tabulator binds each column's title to its
7240
+ * locale, so they change with it and no column is rebuilt:
7241
+ *
7242
+ * yui_tabulator_relocalize(table, t, {device_id: t("device id")});
7243
+ *
7104
7244
  * Every key carries an English `defaultValue`, so an app that does not
7105
7245
  * define it renders exactly what Tabulator rendered before — the
7106
7246
  * keys are an OPPORTUNITY to translate, never a requirement.
@@ -7259,11 +7399,23 @@ function yui_tabulator_name_editor(column_def, name_of) {
7259
7399
  return Object.assign({}, params, { elementAttributes: attrs });
7260
7400
  };
7261
7401
  }
7262
- function yui_tabulator_relocalize(table, t) {
7402
+ /***************************************************************
7403
+ * yui_tabulator_relocalize() -- see "Put an EXISTING table in the
7404
+ * current language" above.
7405
+ *
7406
+ * `titles`, optional: {field: title}, the titles of the columns in
7407
+ * the new language, already translated. They go in the locale
7408
+ * (`columns`), where Tabulator binds each column's title: setLocale()
7409
+ * draws them again without rebuilding a column -- updateDefinition()
7410
+ * re-renders every row, and a row whose formatter builds something (a
7411
+ * nested table) builds it anew. A field left out keeps its title.
7412
+ ***************************************************************/
7413
+ function yui_tabulator_relocalize(table, t, titles) {
7263
7414
  if (!table) return;
7264
7415
  try {
7265
7416
  let name = next_lang_name();
7266
7417
  let strings = tabulator_strings(t);
7418
+ if (titles && typeof titles === "object") strings.columns = Object.assign({}, titles);
7267
7419
  table.options.langs = table.options.langs || {};
7268
7420
  table.options.langs[name] = strings;
7269
7421
  let localize = table.modules && table.modules.localize;
@@ -9482,7 +9634,7 @@ var attrs_table$17 = [
9482
9634
  SDATA_END()
9483
9635
  ];
9484
9636
  var PRIVATE_DATA$17 = {
9485
- rearm_timer: null,
9637
+ loading_rows: 0,
9486
9638
  tables: null,
9487
9639
  table_seq: 0,
9488
9640
  json_names_posted: false,
@@ -9538,18 +9690,12 @@ function mt_stop$17(gobj) {
9538
9690
  * Local Methods
9539
9691
  ***************************/
9540
9692
  /************************************************************
9541
- *
9542
- ************************************************************/
9543
- function isEventSet(table, event) {
9544
- let eventListeners = table.externalEvents.events;
9545
- return eventListeners && eventListeners[event] && eventListeners[event].length > 0;
9546
- }
9547
- /************************************************************
9548
- *
9693
+ * `changes` and the save/undo buttons. What the tables say is
9694
+ * not switched here: they always say it (create_tabulator).
9549
9695
  ************************************************************/
9550
9696
  function set_changed_stated(gobj, changed) {
9551
9697
  let $container = gobj_read_attr(gobj, "$container");
9552
- let $form = $container.querySelector("form");
9698
+ $container.querySelector("form");
9553
9699
  const enable = ($btn, on, color) => {
9554
9700
  if (!$btn) return;
9555
9701
  if (on) $btn.removeAttribute("disabled");
@@ -9564,35 +9710,11 @@ function set_changed_stated(gobj, changed) {
9564
9710
  gobj_write_bool_attr(gobj, "changes", true);
9565
9711
  enable($button_save, true, "MediumSeaGreen");
9566
9712
  enable($button_undo, true, "Magenta");
9567
- $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
9568
- if ($table.tabulator && isEventSet($table.tabulator, "dataChanged")) $table.tabulator.off("dataChanged");
9569
- $table.querySelectorAll(".yui-tabulator-table-nested").forEach(($table_nested) => {
9570
- if ($table_nested.tabulator && isEventSet($table_nested.tabulator, "dataChanged")) $table_nested.tabulator.off("dataChanged");
9571
- });
9572
- });
9573
9713
  } else {
9574
9714
  gobj_write_bool_attr(gobj, "changes", false);
9575
9715
  gobj_write_bool_attr(gobj, "edited", false);
9576
9716
  enable($button_save, false, OFF_COLOR);
9577
9717
  enable($button_undo, false, OFF_COLOR);
9578
- if (gobj.priv.rearm_timer) clearTimeout(gobj.priv.rearm_timer);
9579
- gobj.priv.rearm_timer = setTimeout(function() {
9580
- gobj.priv.rearm_timer = null;
9581
- if (gobj_is_destroying(gobj)) return;
9582
- const rearm = (tabulator) => {
9583
- if (!tabulator) return;
9584
- if (isEventSet(tabulator, "dataChanged")) tabulator.off("dataChanged");
9585
- tabulator.on("dataChanged", function(data) {
9586
- gobj_send_event(gobj, "EV_RECORD_CHANGED", {}, gobj);
9587
- });
9588
- };
9589
- $form.querySelectorAll(".yui-tabulator-table").forEach(($table) => {
9590
- rearm($table.tabulator);
9591
- $table.querySelectorAll(".yui-tabulator-table-nested").forEach(($table_nested) => {
9592
- rearm($table_nested.tabulator);
9593
- });
9594
- });
9595
- }, 200);
9596
9718
  }
9597
9719
  }
9598
9720
  /************************************************************
@@ -9829,10 +9951,6 @@ function build_ui$15(gobj) {
9829
9951
  * Destroy UI
9830
9952
  ************************************************************/
9831
9953
  function destroy_ui$10(gobj) {
9832
- if (gobj.priv && gobj.priv.rearm_timer) {
9833
- clearTimeout(gobj.priv.rearm_timer);
9834
- gobj.priv.rearm_timer = null;
9835
- }
9836
9954
  let $container = gobj_read_attr(gobj, "$container");
9837
9955
  if ($container) {
9838
9956
  destroy_widgets(gobj, $container);
@@ -11226,6 +11344,10 @@ function create_tabulator$1(gobj, $extend, name, template) {
11226
11344
  hozAlign: "center"
11227
11345
  };
11228
11346
  let tabulator = new TabulatorFull($extend, tabulator_settings);
11347
+ tabulator.on("dataChanged", function() {
11348
+ if (gobj.priv.loading_rows > 0) return;
11349
+ gobj_send_event(gobj, "EV_RECORD_CHANGED", {}, gobj);
11350
+ });
11229
11351
  tabulator.on("renderComplete", function() {
11230
11352
  yui_tabulator_name_row_selects(tabulator, t);
11231
11353
  });
@@ -11243,6 +11365,24 @@ function create_tabulator$1(gobj, $extend, name, template) {
11243
11365
  return tabulator;
11244
11366
  }
11245
11367
  /******************************************************************
11368
+ * The title of a table's column: the schema's header, or the
11369
+ * field's name, translated.
11370
+ ******************************************************************/
11371
+ function column_title(field_desc) {
11372
+ return t(field_desc.header || field_desc.name);
11373
+ }
11374
+ /******************************************************************
11375
+ * {field: title} of a table's template, in the current language.
11376
+ ******************************************************************/
11377
+ function table_column_titles(template) {
11378
+ let titles = {};
11379
+ Object.entries(template || {}).forEach(([key, value]) => {
11380
+ const field_desc = template_get_field_desc(key, value);
11381
+ titles[field_desc.name] = column_title(field_desc);
11382
+ });
11383
+ return titles;
11384
+ }
11385
+ /******************************************************************
11246
11386
  * Convert a template's items in tabulator columns
11247
11387
  ******************************************************************/
11248
11388
  function template2columns(gobj, columns, template, sub_elements) {
@@ -11255,7 +11395,7 @@ function template2columns(gobj, columns, template, sub_elements) {
11255
11395
  let validator = [];
11256
11396
  let column = {
11257
11397
  field: field_desc.name,
11258
- title: t(field_desc.header || field_desc.name),
11398
+ title: column_title(field_desc),
11259
11399
  titleFormatter: text_title_formatter,
11260
11400
  editable: get_editable_state,
11261
11401
  editor: false,
@@ -12110,7 +12250,14 @@ function ac_add_table_row(gobj, event, kw, src) {
12110
12250
  }
12111
12251
  let record = kw.record;
12112
12252
  let loading = kw.loading;
12113
- tabulator.addRow(record).then(function(row) {
12253
+ let added;
12254
+ if (loading) gobj.priv.loading_rows++;
12255
+ try {
12256
+ added = tabulator.addRow(record);
12257
+ } finally {
12258
+ if (loading) gobj.priv.loading_rows--;
12259
+ }
12260
+ added.then(function(row) {
12114
12261
  if (loading) {
12115
12262
  let template = $table.template;
12116
12263
  Object.entries(template).forEach(([key, template_value]) => {
@@ -12217,6 +12364,10 @@ function ac_language_changed$10(gobj, event, kw, src) {
12217
12364
  let editor = $editor.jsoneditor;
12218
12365
  if (editor && typeof editor.updateProps === "function") editor.updateProps({ onRenderMenu: json_editor_render_menu(gobj) });
12219
12366
  }
12367
+ for (let $table of $container.querySelectorAll(".yui-tabulator-table, .yui-tabulator-table-nested")) {
12368
+ let tabulator = $table.tabulator;
12369
+ if (tabulator && tabulator.initialized && $table.template) yui_tabulator_relocalize(tabulator, t, table_column_titles($table.template));
12370
+ }
12220
12371
  return 0;
12221
12372
  }
12222
12373
  /***************************
@@ -14996,7 +15147,7 @@ function g6_event_kw(evt) {
14996
15147
  * g6_canvas_tab_order.js
14997
15148
  *
14998
15149
  * The canvases of a G6 graph in the page's Tab order: the main
14999
- * one in its place, the other layers out of it.
15150
+ * one in its place, and NAMED; the other layers out of it.
15000
15151
  *
15001
15152
  * G6 stacks four canvases (background, main, label, transient)
15002
15153
  * and gives each of them `tabIndex = 1` (configCanvasDom, when it
@@ -15009,6 +15160,24 @@ function g6_event_kw(evt) {
15009
15160
  * to the graph's toolbars and buttons in DOM order; the other
15010
15161
  * layers receive nothing (`pointer-events: none`) and take -1.
15011
15162
  *
15163
+ * A canvas in the Tab order is a control, and a control has a
15164
+ * name: the main canvas carries a `title` and an `aria-label`,
15165
+ * through t() and each with its key, that say WHICH graph it is
15166
+ * -- the key is the view's, one per gclass ("json graph",
15167
+ * "schema graph"...). From 7.26.28 to 7.26.41 Tab landed on it
15168
+ * and a reader announced nothing. The keys are what a language
15169
+ * switch reaches (refresh_language()), as on any control. It is
15170
+ * a `region`, as maplibre makes its own canvas: a name on an
15171
+ * element with no role is one ARIA forbids, and a reader is not
15172
+ * bound to say it.
15173
+ *
15174
+ * And it can be SEEN when it has the focus: G6 writes `outline:
15175
+ * none` on its canvases, inline, so a keyboard that Tabbed onto
15176
+ * the graph had no sign of where it was. The main canvas takes
15177
+ * the `G6_MAIN_CANVAS` class, and g6_canvas_tab_order.css --
15178
+ * imported here, so it comes with the module to every view --
15179
+ * draws a ring on it at `:focus-visible`.
15180
+ *
15012
15181
  * Every view that creates a G6 Graph calls
15013
15182
  * keep_canvas_tab_order() right after `new Graph()`: the order is
15014
15183
  * put right each time G6 writes the 1 -- once the canvas is built
@@ -15021,10 +15190,11 @@ function g6_event_kw(evt) {
15021
15190
  * All Rights Reserved.
15022
15191
  ***********************************************************************/
15023
15192
  /************************************************************
15024
- * Main canvas 0, every other layer -1. Returns 0, or -1 with
15025
- * the cause logged.
15193
+ * Main canvas 0, named by `name_key`, and marked for its
15194
+ * focus ring; every other layer -1. Returns 0, or -1 with the
15195
+ * cause logged.
15026
15196
  ************************************************************/
15027
- function set_canvas_tab_order(gobj, graph) {
15197
+ function set_canvas_tab_order(gobj, graph, name_key) {
15028
15198
  let canvas = graph ? graph.getCanvas() : null;
15029
15199
  if (!canvas || typeof canvas.getLayers !== "function") {
15030
15200
  log_error(`${gobj_short_name(gobj)}: no canvas to set the Tab order of`);
@@ -15044,17 +15214,27 @@ function set_canvas_tab_order(gobj, graph) {
15044
15214
  ret = -1;
15045
15215
  continue;
15046
15216
  }
15047
- $el.tabIndex = name === "main" ? 0 : -1;
15217
+ if (name !== "main") {
15218
+ $el.tabIndex = -1;
15219
+ continue;
15220
+ }
15221
+ $el.tabIndex = 0;
15222
+ $el.classList.add("G6_MAIN_CANVAS");
15223
+ $el.setAttribute("role", "region");
15224
+ $el.setAttribute("title", t(name_key));
15225
+ $el.setAttribute("data-i18n-title", name_key);
15226
+ $el.setAttribute("aria-label", t(name_key));
15227
+ $el.setAttribute("data-i18n-aria-label", name_key);
15048
15228
  }
15049
15229
  return ret;
15050
15230
  }
15051
15231
  /************************************************************
15052
- * Keep the order for the life of `graph`: on every moment G6
15053
- * writes its own.
15232
+ * Keep the order, and the name, for the life of `graph`: on
15233
+ * every moment G6 writes its own.
15054
15234
  ************************************************************/
15055
- function keep_canvas_tab_order(gobj, graph) {
15235
+ function keep_canvas_tab_order(gobj, graph, name_key) {
15056
15236
  for (let ev of [GraphEvent.AFTER_CANVAS_INIT, GraphEvent.AFTER_RENDERER_CHANGE]) graph.on(ev, () => {
15057
- set_canvas_tab_order(gobj, graph);
15237
+ set_canvas_tab_order(gobj, graph, name_key);
15058
15238
  });
15059
15239
  }
15060
15240
  //#endregion
@@ -15563,7 +15743,7 @@ function build_graph$4(gobj) {
15563
15743
  behaviors: BEHAVIORS_READING$1.slice()
15564
15744
  });
15565
15745
  if (priv.theme) graph.setTheme(priv.theme);
15566
- keep_canvas_tab_order(gobj, graph);
15746
+ keep_canvas_tab_order(gobj, graph, "json graph");
15567
15747
  graph.on(NodeEvent.CLICK, (evt) => {
15568
15748
  gobj_send_event(gobj, "EV_NODE_CLICK", g6_event_kw(evt), gobj);
15569
15749
  });
@@ -19483,7 +19663,7 @@ function build_graph$3(gobj) {
19483
19663
  } catch (e) {
19484
19664
  log_error(`${gobj_short_name(gobj)}: the theme was refused: ${e}`);
19485
19665
  }
19486
- keep_canvas_tab_order(gobj, priv.graph);
19666
+ keep_canvas_tab_order(gobj, priv.graph, "fsm graph");
19487
19667
  priv.graph.on("aftertransform", () => {
19488
19668
  yui_graph_update_zoom(gobj_read_attr(gobj, "$container"), priv.graph);
19489
19669
  });
@@ -22126,6 +22306,17 @@ function close_gclass_view(handle) {
22126
22306
  * lands BEHIND its opener whatever number it is given, and
22127
22307
  * the button reads as one that did nothing.
22128
22308
  *
22309
+ * An opener in the place the shell gives every window -- its
22310
+ * window layer, the body while there is none -- gives the
22311
+ * viewer no `$parent` at all: the viewer takes that place too,
22312
+ * and FOLLOWS the shell with its opener (C_YUI_WINDOW's
22313
+ * ac_shell_changed). Up to 7.26.41 it was handed that element
22314
+ * by name, and a name is a choice its host made: a viewer
22315
+ * opened from the developer window between a logout and the
22316
+ * next login was told "the body", and stayed there after the
22317
+ * login -- above the new shell's dialogs -- while its opener
22318
+ * moved into the shell.
22319
+ *
22129
22320
  * Opened from no window: null -- the window layer of the
22130
22321
  * shell, where every window lives (the legacy '#top-layer'
22131
22322
  * when a page has one). It was the shell's popup layer: above
@@ -22135,7 +22326,11 @@ function window_layer_of(host) {
22135
22326
  let $c = gobj_read_pointer_attr(host, "$container");
22136
22327
  if ($c && typeof $c.closest === "function") {
22137
22328
  let $win = $c.closest(".C_YUI_WINDOW");
22138
- if ($win && $win.parentNode) return $win.parentNode;
22329
+ if ($win && $win.parentNode) {
22330
+ let $shell_place = yui_shell_window_layer(yui_shell_of(host)) || document.body;
22331
+ if ($win.parentNode === $shell_place) return null;
22332
+ return $win.parentNode;
22333
+ }
22139
22334
  }
22140
22335
  return typeof document !== "undefined" && document.getElementById("top-layer") || null;
22141
22336
  }
@@ -22996,7 +23191,7 @@ function build_graph$2(gobj) {
22996
23191
  behaviors: BEHAVIORS_READING.slice()
22997
23192
  });
22998
23193
  if (priv.theme) graph.setTheme(priv.theme);
22999
- keep_canvas_tab_order(gobj, graph);
23194
+ keep_canvas_tab_order(gobj, graph, "gobj tree graph");
23000
23195
  graph.on("aftertransform", () => {
23001
23196
  yui_graph_update_zoom(gobj_read_attr(gobj, "$container"), priv.graph);
23002
23197
  let z = priv.last_zoom;
@@ -24584,16 +24779,17 @@ function card_descriptor(it, show_label, badge_of) {
24584
24779
  text_node(label)
24585
24780
  ]);
24586
24781
  if (badge && !pinned) children.push(badge);
24782
+ let name_key = label || it.aria_label || it.id || "";
24587
24783
  let a_attrs = {
24588
24784
  class: "yui-nav-item yui-nav-card",
24589
24785
  href: it.route ? "#" + it.route : "#",
24590
24786
  "data-item-id": it.id,
24591
24787
  "data-route": it.route || "",
24592
24788
  "data-disabled": it.disabled ? "1" : "0",
24593
- "aria-label": label || it.id
24789
+ "aria-label": name_key
24594
24790
  };
24595
- if (label) a_attrs["data-i18n-aria-label"] = label;
24596
- let tip = it.tooltip || it.aria_label || label;
24791
+ if (name_key) a_attrs["data-i18n-aria-label"] = name_key;
24792
+ let tip = it.tooltip || it.aria_label || name_key;
24597
24793
  if (tip) {
24598
24794
  a_attrs.title = tip;
24599
24795
  a_attrs["data-i18n-title"] = tip;
@@ -24992,15 +25188,15 @@ function render_tabs(gobj, items) {
24992
25188
  "aria-hidden": "true"
24993
25189
  }]
24994
25190
  ]);
24995
- let label = it.name || "";
25191
+ let name_key = it.name || it.aria_label || it.id || "";
24996
25192
  let a_attrs = {
24997
25193
  href: it.route ? "#" + it.route : "#",
24998
25194
  "data-item-id": it.id,
24999
25195
  "data-route": it.route || "",
25000
- "aria-label": label || it.id
25196
+ "aria-label": name_key
25001
25197
  };
25002
- if (label) a_attrs["data-i18n-aria-label"] = label;
25003
- let tip = it.tooltip || it.aria_label || label;
25198
+ if (name_key) a_attrs["data-i18n-aria-label"] = name_key;
25199
+ let tip = it.tooltip || it.aria_label || name_key;
25004
25200
  if (tip) {
25005
25201
  a_attrs.title = tip;
25006
25202
  a_attrs["data-i18n-title"] = tip;
@@ -25080,16 +25276,17 @@ function render_breadcrumb(gobj, items) {
25080
25276
  text_node(label)
25081
25277
  ]);
25082
25278
  }
25279
+ let name_key = it.name || it.aria_label || it.id || "";
25083
25280
  let a_attrs = {
25084
25281
  class: "yui-nav-item yui-nav-crumb",
25085
25282
  href: it.route ? "#" + it.route : "#",
25086
25283
  "data-item-id": it.id,
25087
25284
  "data-route": it.route || "",
25088
25285
  "data-disabled": it.disabled ? "1" : "0",
25089
- "aria-label": it.name || it.id
25286
+ "aria-label": name_key
25090
25287
  };
25091
- if (it.name) a_attrs["data-i18n-aria-label"] = it.name;
25092
- let tip = it.tooltip || it.aria_label || it.name;
25288
+ if (name_key) a_attrs["data-i18n-aria-label"] = name_key;
25289
+ let tip = it.tooltip || it.aria_label || name_key;
25093
25290
  if (tip) {
25094
25291
  a_attrs.title = tip;
25095
25292
  a_attrs["data-i18n-title"] = tip;
@@ -25226,12 +25423,14 @@ function render_accordion(gobj, items) {
25226
25423
  "aria-controls": body_id
25227
25424
  };
25228
25425
  let head_badge = item_badge_node(gobj, it, false);
25229
- if (!empty_string(head_text)) {
25230
- head_attrs.i18n = head_text;
25231
- head_attrs.title = head_text;
25232
- head_attrs["data-i18n-title"] = head_text;
25233
- head_attrs["aria-label"] = head_text;
25234
- head_attrs["data-i18n-aria-label"] = head_text;
25426
+ if (!empty_string(head_text)) head_attrs.i18n = head_text;
25427
+ let name_key = it.name || it.aria_label || it.id || "";
25428
+ if (!empty_string(name_key)) {
25429
+ let tip = it.tooltip || it.aria_label || name_key;
25430
+ head_attrs.title = tip;
25431
+ head_attrs["data-i18n-title"] = tip;
25432
+ head_attrs["aria-label"] = name_key;
25433
+ head_attrs["data-i18n-aria-label"] = name_key;
25235
25434
  name_control_with_badge(head_attrs, head_badge);
25236
25435
  }
25237
25436
  let $hdr = createElement2([
@@ -25307,17 +25506,17 @@ function item_li(gobj, it, opts) {
25307
25506
  if (label_el) children.push(label_el);
25308
25507
  if (!pinned) children.push(badge_el);
25309
25508
  }
25310
- let aria_key = label || it.id;
25509
+ let name_key = it.name || it.aria_label || it.id || "";
25311
25510
  let a_attrs = {
25312
25511
  class: a_class,
25313
25512
  href: it.route ? "#" + it.route : "#",
25314
25513
  "data-item-id": it.id,
25315
25514
  "data-route": it.route || "",
25316
25515
  "data-disabled": it.disabled ? "1" : "0",
25317
- "aria-label": aria_key
25516
+ "aria-label": name_key
25318
25517
  };
25319
- if (label) a_attrs["data-i18n-aria-label"] = label;
25320
- let tip = it.tooltip || it.aria_label || label;
25518
+ if (name_key) a_attrs["data-i18n-aria-label"] = name_key;
25519
+ let tip = it.tooltip || it.aria_label || name_key;
25321
25520
  if (tip) {
25322
25521
  a_attrs.title = tip;
25323
25522
  a_attrs["data-i18n-title"] = tip;
@@ -25360,15 +25559,16 @@ function item_iconbar(gobj, it, opts) {
25360
25559
  if (label_el) children.push(label_el);
25361
25560
  }
25362
25561
  if (!pinned) children.push(badge_el);
25562
+ let name_key = it.name || it.aria_label || it.id || "";
25363
25563
  let a_attrs = {
25364
25564
  class: "yui-nav-item yui-nav-stacked",
25365
25565
  href: it.route ? "#" + it.route : "#",
25366
25566
  "data-item-id": it.id,
25367
25567
  "data-route": it.route || "",
25368
- "aria-label": label || it.id
25568
+ "aria-label": name_key
25369
25569
  };
25370
- if (label) a_attrs["data-i18n-aria-label"] = label;
25371
- let tip = it.tooltip || it.aria_label || label;
25570
+ if (name_key) a_attrs["data-i18n-aria-label"] = name_key;
25571
+ let tip = it.tooltip || it.aria_label || name_key;
25372
25572
  if (tip) {
25373
25573
  a_attrs.title = tip;
25374
25574
  a_attrs["data-i18n-title"] = tip;
@@ -25636,7 +25836,12 @@ function render_node(node) {
25636
25836
  "aria-hidden": "true"
25637
25837
  }]]
25638
25838
  ]);
25639
- row.push([
25839
+ if (node.label && node.data_label) row.push([
25840
+ "span",
25841
+ { class: "ROUTEMAP_NAME" },
25842
+ text_node(node.label)
25843
+ ]);
25844
+ else if (node.label) row.push([
25640
25845
  "span",
25641
25846
  {
25642
25847
  class: "ROUTEMAP_NAME",
@@ -25689,10 +25894,10 @@ function render_node(node) {
25689
25894
  href: "#" + node.route,
25690
25895
  title: node.route
25691
25896
  };
25692
- if (node.label) {
25897
+ if (node.label && !node.data_label) {
25693
25898
  a_attrs["aria-label"] = node.label;
25694
25899
  a_attrs["data-i18n-aria-label"] = node.label;
25695
- }
25900
+ } else a_attrs["aria-label"] = node.label || node.route;
25696
25901
  if (node.current) a_attrs["aria-current"] = "page";
25697
25902
  $row = createElement2([
25698
25903
  "a",
@@ -62853,7 +63058,7 @@ function build_graph$1(gobj) {
62853
63058
  plugins: []
62854
63059
  });
62855
63060
  graph.setTheme(priv.theme);
62856
- keep_canvas_tab_order(gobj, graph);
63061
+ keep_canvas_tab_order(gobj, graph, "treedb graph");
62857
63062
  priv._unforward_wheel = yui_graph_forward_wheel(graph, priv.$container, { selector: ".TREEDB_CARD, .TREEDB_PILLS" });
62858
63063
  graph.setLayout(layout);
62859
63064
  priv.graph_rendered = false;
@@ -74542,7 +74747,7 @@ function build_graph(gobj) {
74542
74747
  }
74543
74748
  priv.graph = graph;
74544
74749
  graph.setTheme(dark ? "dark" : "light");
74545
- keep_canvas_tab_order(gobj, graph);
74750
+ keep_canvas_tab_order(gobj, graph, "schema graph");
74546
74751
  graph.on("aftertransform", () => {
74547
74752
  yui_graph_update_zoom($container, priv.graph);
74548
74753
  });
@@ -76657,6 +76862,7 @@ var PRIVATE_DATA$1 = {
76657
76862
  export_view: null
76658
76863
  };
76659
76864
  var __gclass__$1 = null;
76865
+ var __described_seq__ = 0;
76660
76866
  /******************************
76661
76867
  * Framework Methods
76662
76868
  ******************************/
@@ -77457,6 +77663,15 @@ function render(gobj) {
77457
77663
  * A card that opens something, with its own logical name. The
77458
77664
  * cards grid is the shell's, so a schema card and a nav card
77459
77665
  * look alike on purpose.
77666
+ *
77667
+ * `title` is the card's name: `{i18n: key}`, or `{text: data}` for
77668
+ * a name no locale holds (a treedb's id). The card is a control --
77669
+ * a role=button that Enter and Space press -- and a control is
77670
+ * NAMED: a title and an aria-label, with their keys when the name
77671
+ * is one, and its tags (the counts) as its description, which an
77672
+ * aria-label alone would hide from a reader. Up to 7.26.41 it had
77673
+ * neither, and the orphans card was handed its name translated,
77674
+ * in the language it was drawn in for good.
77460
77675
  ***************************************************************/
77461
77676
  function open_card(gobj, logical, title, icon, tags, event, kw) {
77462
77677
  let $tags = tags.map((tag) => {
@@ -77474,13 +77689,36 @@ function open_card(gobj, logical, title, icon, tags, event, kw) {
77474
77689
  ]] : `${tag.text}`
77475
77690
  ];
77476
77691
  });
77692
+ let tags_id = `yui-schema-described-${++__described_seq__}`;
77693
+ let card_attrs = {
77694
+ class: `${logical} yui-nav-card card`,
77695
+ role: "button",
77696
+ tabindex: "0",
77697
+ "aria-describedby": tags_id
77698
+ };
77699
+ let $name;
77700
+ if (title.i18n) {
77701
+ Object.assign(card_attrs, name_attrs(title.i18n, {}));
77702
+ $name = [
77703
+ "span",
77704
+ {
77705
+ class: `${logical}_NAME has-text-weight-semibold`,
77706
+ i18n: title.i18n
77707
+ },
77708
+ t(title.i18n)
77709
+ ];
77710
+ } else {
77711
+ card_attrs.title = String(title.text);
77712
+ card_attrs["aria-label"] = String(title.text);
77713
+ $name = [
77714
+ "span",
77715
+ { class: `${logical}_NAME has-text-weight-semibold` },
77716
+ text_node(title.text)
77717
+ ];
77718
+ }
77477
77719
  return [
77478
77720
  "div",
77479
- {
77480
- class: `${logical} yui-nav-card card`,
77481
- role: "button",
77482
- tabindex: "0"
77483
- },
77721
+ card_attrs,
77484
77722
  [[
77485
77723
  "div",
77486
77724
  { class: `${logical}_BODY card-content p-3` },
@@ -77493,16 +77731,16 @@ function open_card(gobj, logical, title, icon, tags, event, kw) {
77493
77731
  [[
77494
77732
  "span",
77495
77733
  { class: "icon" },
77496
- [["i", { class: icon }]]
77497
- ], [
77498
- "span",
77499
- { class: `${logical}_NAME has-text-weight-semibold` },
77500
- text_node(title)
77501
- ]]
77734
+ [["i", {
77735
+ class: icon,
77736
+ "aria-hidden": "true"
77737
+ }]]
77738
+ ], $name]
77502
77739
  ], [
77503
77740
  "div",
77504
77741
  {
77505
77742
  class: `${logical}_TAGS tags mt-2`,
77743
+ id: tags_id,
77506
77744
  style: "gap:.25rem;"
77507
77745
  },
77508
77746
  $tags
@@ -77550,9 +77788,9 @@ function render_treedbs(gobj, $body) {
77550
77788
  style: "is-warning is-light"
77551
77789
  }] : []
77552
77790
  ];
77553
- $cards.push(open_card(gobj, "SCHEMA_TREEDB_CARD", treedb.id, "yi-database", tags, "EV_SELECT_TREEDB", { treedb: treedb.id }));
77791
+ $cards.push(open_card(gobj, "SCHEMA_TREEDB_CARD", { text: treedb.id }, "yi-database", tags, "EV_SELECT_TREEDB", { treedb: treedb.id }));
77554
77792
  }
77555
- if (priv.model.orphan_topics.length > 0 || priv.model.orphan_cols.length > 0) $cards.push(open_card(gobj, "SCHEMA_ORPHAN_CARD", t("orphans"), "yi-triangle-exclamation", [{
77793
+ if (priv.model.orphan_topics.length > 0 || priv.model.orphan_cols.length > 0) $cards.push(open_card(gobj, "SCHEMA_ORPHAN_CARD", { i18n: "orphans" }, "yi-triangle-exclamation", [{
77556
77794
  i18n: "topics",
77557
77795
  text: priv.model.orphan_topics.length
77558
77796
  }, {
@@ -77593,22 +77831,33 @@ function render_topics(gobj, $body) {
77593
77831
  $actions.push(row_icon(gobj, "SCHEMA_TOPIC_EDIT", "yi-pen", "edit topic", "EV_EDIT_TOPIC", { topic: address }));
77594
77832
  $actions.push(row_icon(gobj, "SCHEMA_TOPIC_DELETE", "yi-trash", "delete topic", "EV_DELETE_TOPIC", { topic: address }));
77595
77833
  }
77834
+ let open_attrs = {
77835
+ class: "SCHEMA_TOPIC_OPEN has-text-weight-semibold",
77836
+ type: "button",
77837
+ title: topic.name,
77838
+ "aria-label": topic.name
77839
+ };
77840
+ let id_attrs = { class: "SCHEMA_TOPIC_ID is-size-7 yui-text-quiet" };
77841
+ if (ambiguous) {
77842
+ id_attrs.id = `yui-schema-described-${++__described_seq__}`;
77843
+ open_attrs["aria-describedby"] = id_attrs.id;
77844
+ }
77596
77845
  $rows.push([
77597
77846
  "tr",
77598
- {
77599
- class: "SCHEMA_TOPIC_ROW",
77600
- role: "button",
77601
- tabindex: "0"
77602
- },
77847
+ { class: "SCHEMA_TOPIC_ROW" },
77603
77848
  [
77604
77849
  [
77605
77850
  "td",
77606
77851
  { class: "SCHEMA_TOPIC_NAME" },
77607
77852
  [
77608
77853
  [
77609
- "span",
77610
- { class: "has-text-weight-semibold" },
77611
- text_node(topic.name)
77854
+ "button",
77855
+ open_attrs,
77856
+ text_node(topic.name),
77857
+ { click: (evt) => {
77858
+ evt.stopPropagation();
77859
+ gobj_send_event(gobj, "EV_SELECT_TOPIC", { topic: address }, gobj);
77860
+ } }
77612
77861
  ],
77613
77862
  topic.system_topic ? [
77614
77863
  "span",
@@ -77638,7 +77887,7 @@ function render_topics(gobj, $body) {
77638
77887
  ],
77639
77888
  ambiguous ? [
77640
77889
  "div",
77641
- { class: "SCHEMA_TOPIC_ID is-size-7 yui-text-quiet" },
77890
+ id_attrs,
77642
77891
  [[
77643
77892
  "code",
77644
77893
  {},
@@ -77680,17 +77929,10 @@ function render_topics(gobj, $body) {
77680
77929
  $actions
77681
77930
  ]
77682
77931
  ],
77683
- {
77684
- click: (evt) => {
77685
- if (evt.target.closest(".SCHEMA_TOPIC_ACTIONS")) return;
77686
- gobj_send_event(gobj, "EV_SELECT_TOPIC", { topic: address }, gobj);
77687
- },
77688
- keydown: (evt) => {
77689
- if (evt.key !== "Enter" && evt.key !== " ") return;
77690
- evt.preventDefault();
77691
- gobj_send_event(gobj, "EV_SELECT_TOPIC", { topic: address }, gobj);
77692
- }
77693
- }
77932
+ { click: (evt) => {
77933
+ if (evt.target.closest(".SCHEMA_TOPIC_ACTIONS")) return;
77934
+ gobj_send_event(gobj, "EV_SELECT_TOPIC", { topic: address }, gobj);
77935
+ } }
77694
77936
  ]);
77695
77937
  }
77696
77938
  let $table = createElement2([