@yuneta/gobj-ui 7.27.32 → 7.27.33

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.
@@ -1097,6 +1097,72 @@ function build_nav_map(input) {
1097
1097
  };
1098
1098
  }
1099
1099
  //#endregion
1100
+ //#region src/yui_selector.js
1101
+ /***********************************************************************
1102
+ * yui_selector.js
1103
+ *
1104
+ * A NAME IS DATA, NOT A SELECTOR.
1105
+ *
1106
+ * A gobj name, a topic, a route, a key: any of them may hold a
1107
+ * character that means something to CSS. Pasted into a selector,
1108
+ * it changes what the selector says or breaks it:
1109
+ *
1110
+ * - `~ + > space` are combinators: `#a~b` is "a b after an #a",
1111
+ * and the lookup answers null;
1112
+ * - `.` `#` `:` `[` start another simple selector: `#a.b` is the
1113
+ * element #a with the class b;
1114
+ * - `%` `^` `"` `\` and the rest make it INVALID: querySelector
1115
+ * THROWS a SyntaxError, out of whatever action was running.
1116
+ *
1117
+ * REV-CLOUD V40.3.1: the gobj tree found its canvas with
1118
+ * `querySelector("#" + id)`, and gui_agent named the window
1119
+ * `node~key` -- every open logged "no canvas mount" and the
1120
+ * canvas never resized; a `^` in the key (`%5E`) threw out of
1121
+ * mt_start and left an orphan window behind it.
1122
+ *
1123
+ * So data reaches a selector in one of two ways only:
1124
+ *
1125
+ * find_by_id($root, id) the element below $root whose id is
1126
+ * `id` -- no selector is built at all.
1127
+ * It works in a tree that is not in the
1128
+ * document yet, where getElementById()
1129
+ * answers null.
1130
+ *
1131
+ * css_string(value) the value written inside a DOUBLE
1132
+ * quoted CSS string, for an attribute
1133
+ * selector:
1134
+ * '[data-x="' + css_string(v) + '"]'
1135
+ *
1136
+ * `CSS.escape()` is not used: it does not exist in node, where the
1137
+ * wiring tests run, and inside a quoted string only the quote, the
1138
+ * backslash and the control characters have to be escaped.
1139
+ *
1140
+ * Copyright (c) 2026, ArtGins.
1141
+ * All Rights Reserved.
1142
+ ***********************************************************************/
1143
+ /************************************************************
1144
+ * The element below `$root` (not `$root` itself, as with
1145
+ * querySelector) whose id is exactly `id`, or null.
1146
+ ************************************************************/
1147
+ function find_by_id($root, id) {
1148
+ if (!$root || typeof $root.querySelectorAll !== "function") return null;
1149
+ if (id === null || id === void 0 || id === "") return null;
1150
+ let wanted = String(id);
1151
+ for (let $el of $root.querySelectorAll("[id]")) if ($el.id === wanted) return $el;
1152
+ return null;
1153
+ }
1154
+ /************************************************************
1155
+ * `value` as the body of a double-quoted CSS string.
1156
+ *
1157
+ * The quote and the backslash take a backslash; a control
1158
+ * character (a newline ends a CSS string, it is a parse
1159
+ * error inside one) is written as its hex escape, which a
1160
+ * space ends so the next character is never read as hex.
1161
+ ************************************************************/
1162
+ function css_string(value) {
1163
+ return String(value).replace(/[\\"]/g, "\\$&").replace(/[\u0000-\u001f\u007f]/g, (c) => "\\" + c.charCodeAt(0).toString(16) + " ");
1164
+ }
1165
+ //#endregion
1100
1166
  //#region src/shell_section_index.js
1101
1167
  /***********************************************************************
1102
1168
  * shell_section_index.js
@@ -4179,7 +4245,7 @@ function yui_shell_set_connection_state(shell_gobj, connected) {
4179
4245
  function yui_shell_set_toolbar_item_icon(shell_gobj, item_id, icon_class) {
4180
4246
  let $container = gobj_read_attr(shell_gobj, "$container");
4181
4247
  if (!$container || empty_string(item_id) || empty_string(icon_class)) return;
4182
- let $i = $container.querySelector(`[data-toolbar-item-id="${item_id}"] .icon i`);
4248
+ let $i = $container.querySelector(`[data-toolbar-item-id="${css_string(item_id)}"] .icon i`);
4183
4249
  if ($i) $i.className = icon_class;
4184
4250
  }
4185
4251
  /************************************************************
@@ -4213,7 +4279,7 @@ function yui_shell_set_toolbar_item_badge(shell_gobj, item_id, value, tone) {
4213
4279
  if (!shell_gobj || !is_gobj(shell_gobj) || empty_string(item_id)) return;
4214
4280
  let $container = gobj_read_attr(shell_gobj, "$container");
4215
4281
  if (!$container) return;
4216
- let $badge = $container.querySelector(`[data-toolbar-item-id="${item_id}"] .yui-toolbar-badge`);
4282
+ let $badge = $container.querySelector(`[data-toolbar-item-id="${css_string(item_id)}"] .yui-toolbar-badge`);
4217
4283
  if (!$badge) return;
4218
4284
  let before = $badge.hasAttribute("hidden") ? "" : $badge.textContent;
4219
4285
  paint_badge($badge, value, tone);
@@ -12578,7 +12644,7 @@ function apply_form_mode(gobj, $form) {
12578
12644
  let mode = gobj_read_str_attr(gobj, "form_mode");
12579
12645
  if (empty_string(mode)) return;
12580
12646
  let pkey = gobj_read_str_attr(gobj, "pkey");
12581
- let $input = $form.querySelector(`[name="${pkey}"]`);
12647
+ let $input = $form.querySelector(`[name="${css_string(pkey)}"]`);
12582
12648
  if (!$input) {
12583
12649
  log_error(sprintf("%s: form_mode '%s' but form has no pkey field '%s'", gobj_short_name(gobj), mode, pkey));
12584
12650
  return;
@@ -13646,7 +13712,7 @@ function template2columns(gobj, columns, template, sub_elements) {
13646
13712
  hozAlign: "center",
13647
13713
  cellClick: function(evt, cell) {
13648
13714
  evt.stopPropagation();
13649
- let $extend = cell.getRow().getElement().querySelector(`[name="${field_desc.name}"]`);
13715
+ let $extend = cell.getRow().getElement().querySelector(`[name="${css_string(field_desc.name)}"]`);
13650
13716
  if (!$extend) {
13651
13717
  log_error(`${gobj_short_name(gobj)}: nested table '${field_desc.name}' not found in its row`);
13652
13718
  return;
@@ -18104,7 +18170,7 @@ function build_ui$13(gobj) {
18104
18170
  ]]
18105
18171
  ]);
18106
18172
  gobj_write_attr(gobj, "$container", $container);
18107
- let $mount = $container.querySelector("#" + priv.canvas_id);
18173
+ let $mount = find_by_id($container, priv.canvas_id);
18108
18174
  if ($mount) {
18109
18175
  priv.fold_listener = function(evt) {
18110
18176
  let $handle = evt.target && evt.target.closest ? evt.target.closest("[data-fold-path]") : null;
@@ -18133,7 +18199,7 @@ function destroy_ui$8(gobj) {
18133
18199
  let priv = gobj.priv;
18134
18200
  let $container = gobj_read_attr(gobj, "$container");
18135
18201
  if (priv.fold_listener) {
18136
- let $mount = $container ? $container.querySelector("#" + priv.canvas_id) : null;
18202
+ let $mount = find_by_id($container, priv.canvas_id);
18137
18203
  if ($mount) for (let type of FOLD_SWALLOWED_EVENTS$1) $mount.removeEventListener(type, priv.fold_listener, true);
18138
18204
  priv.fold_listener = null;
18139
18205
  }
@@ -18274,7 +18340,7 @@ function make_toolbar$5(gobj) {
18274
18340
  function canvas_mount$2(gobj) {
18275
18341
  let $container = gobj_read_attr(gobj, "$container");
18276
18342
  if (!$container) return null;
18277
- return $container.querySelector("#" + gobj.priv.canvas_id);
18343
+ return find_by_id($container, gobj.priv.canvas_id);
18278
18344
  }
18279
18345
  /************************************************************
18280
18346
  * Build a G6 graph instance
@@ -19145,7 +19211,7 @@ function paint_anchor_mark$1(gobj) {
19145
19211
  if (!$container) return;
19146
19212
  for (let $card of $container.querySelectorAll(".JSON_CARD_ANCHORED")) $card.classList.remove("JSON_CARD_ANCHORED");
19147
19213
  if (priv.anchor_state !== "on" || !priv.anchor_path) return;
19148
- let $it = $container.querySelector(".JSON_CARD[data-json-path=\"" + CSS.escape(priv.anchor_path) + "\"]");
19214
+ let $it = $container.querySelector(".JSON_CARD[data-json-path=\"" + css_string(priv.anchor_path) + "\"]");
19149
19215
  if ($it) $it.classList.add("JSON_CARD_ANCHORED");
19150
19216
  }
19151
19217
  /************************************************************
@@ -22611,7 +22677,7 @@ function make_toolbar$3(gobj) {
22611
22677
  function canvas_mount$1(gobj) {
22612
22678
  let $container = gobj_read_attr(gobj, "$container");
22613
22679
  if (!$container) return null;
22614
- return $container.querySelector("#" + gobj_read_str_attr(gobj, "canvas_id"));
22680
+ return find_by_id($container, gobj_read_str_attr(gobj, "canvas_id"));
22615
22681
  }
22616
22682
  /************************************************************
22617
22683
  * Build the G6 graph instance.
@@ -52243,12 +52309,13 @@ function yui_graph_minimap_repaint(plugin) {
52243
52309
  * it WANTS and the host answers with the data:
52244
52310
  *
52245
52311
  * out EV_TREE_WANTED {} Refresh pressed
52246
- * in EV_LOAD_TREE {tree} the `view-gobj-tree` answer
52247
- * out EV_TRACE_INFO_WANTED {gclass} a card was opened
52312
+ * in EV_LOAD_TREE {tree, set_id} the `view-gobj-tree` answer
52313
+ * out EV_TRACE_INFO_WANTED {gclass, set_id} a card was opened
52248
52314
  * in EV_TRACE_INFO {gclass, gclass_levels, global_levels,
52249
- * gclass_on, global_on, error}
52315
+ * gclass_on, global_on, error, set_id}
52250
52316
  * out EV_SET_TRACE_LEVEL {scope: "gobj"|"gclass"|"global",
52251
- * gobj, gclass, levels: [...], set}
52317
+ * gobj, gclass, levels: [...], set,
52318
+ * set_id}
52252
52319
  * out EV_GCLASS_WANTED {gclass} the gclass button
52253
52320
  * in EV_GCLASS_DESCRIPTION {gclass, description}
52254
52321
  *
@@ -52258,6 +52325,14 @@ function yui_graph_minimap_repaint(plugin) {
52258
52325
  * trace info of `gclass` again: what the reader is on stays
52259
52326
  * open.
52260
52327
  *
52328
+ * `set_id` (7.27.33) numbers each set. A host that echoes
52329
+ * it says WHICH set an answer follows: the set_id of the
52330
+ * set in the two reads made after it (and in the answer of
52331
+ * a WANTED that carried one), null in any other answer. A
52332
+ * read asked BEFORE a set and answered after it then no
52333
+ * longer unlocks what the set locked. A host that leaves
52334
+ * it out is matched by gclass, as before.
52335
+ *
52261
52336
  * TRACES, in "remote": three scopes, each where it belongs.
52262
52337
  * The kernel's levels (`machine`, `create_delete`...; the
52263
52338
  * table gobj.c calls "global") are valid in all three, a
@@ -52472,6 +52547,9 @@ var PRIVATE_DATA$9 = {
52472
52547
  viewer_awaits: "",
52473
52548
  viewer_stale: "",
52474
52549
  set_in_flight: null,
52550
+ set_serial: 0,
52551
+ pending_set_id: 0,
52552
+ viewer_awaits_set: 0,
52475
52553
  view_refused: false
52476
52554
  };
52477
52555
  var __gclass__$9 = null;
@@ -53203,7 +53281,7 @@ function make_toolbar$1(gobj) {
53203
53281
  function canvas_mount(gobj) {
53204
53282
  let $container = gobj_read_attr(gobj, "$container");
53205
53283
  if (!$container) return null;
53206
- return $container.querySelector("#" + gobj.priv.canvas_id);
53284
+ return find_by_id($container, gobj.priv.canvas_id);
53207
53285
  }
53208
53286
  /************************************************************
53209
53287
  * Build a G6 graph instance
@@ -54677,7 +54755,7 @@ function paint_anchor_mark(gobj) {
54677
54755
  if (!$container) return;
54678
54756
  for (let $card of $container.querySelectorAll(".GOBJ_CARD_ANCHORED")) $card.classList.remove("GOBJ_CARD_ANCHORED");
54679
54757
  if (priv.anchor_state !== "on" || !priv.anchor_name) return;
54680
- let $it = $container.querySelector(".GOBJ_CARD[data-gobj-name=\"" + CSS.escape(priv.anchor_name) + "\"]");
54758
+ let $it = $container.querySelector(".GOBJ_CARD[data-gobj-name=\"" + css_string(priv.anchor_name) + "\"]");
54681
54759
  if ($it) $it.classList.add("GOBJ_CARD_ANCHORED");
54682
54760
  }
54683
54761
  /************************************************************
@@ -54917,7 +54995,7 @@ function ac_load_tree(gobj, event, kw, src) {
54917
54995
  }
54918
54996
  let first = !priv.remote_root;
54919
54997
  priv.remote_root = root;
54920
- priv.trace_pending = false;
54998
+ if (answers_set(kw, priv.pending_set_id)) priv.trace_pending = false;
54921
54999
  reload_keeping_popover(gobj, first ? {} : { preserve_view: true });
54922
55000
  return 0;
54923
55001
  }
@@ -54939,24 +55017,29 @@ function ac_trace_info(gobj, event, kw, src) {
54939
55017
  global_on: list(kw.global_on),
54940
55018
  error: kw.error || ""
54941
55019
  };
54942
- priv.trace_pending = false;
54943
- if (priv.set_in_flight && priv.set_in_flight.gclass === kw.gclass) priv.set_in_flight = null;
55020
+ if (answers_set(kw, priv.pending_set_id)) priv.trace_pending = false;
55021
+ if (priv.set_in_flight && priv.set_in_flight.gclass === kw.gclass && answers_set(kw, priv.set_in_flight.set_id)) priv.set_in_flight = null;
54944
55022
  let d = priv.popover_node;
54945
55023
  let root = priv.remote_root;
54946
55024
  if (priv.popover_mode === "node" && d && d.gclass === kw.gclass || priv.popover_mode === "yuno" && root && root.gclass === kw.gclass) render_current_popover(gobj);
54947
55025
  let viewer = gclass_viewer_gobj(gobj);
54948
55026
  if (viewer) {
54949
55027
  let shown = gobj_read_str_attr(viewer, "gclass_name");
54950
- if (priv.viewer_awaits === kw.gclass) {
55028
+ if (priv.viewer_awaits === kw.gclass && answers_set(kw, priv.viewer_awaits_set)) {
54951
55029
  priv.viewer_awaits = "";
54952
55030
  if (priv.viewer_stale === shown && shown !== kw.gclass) {
55031
+ let set_id = priv.viewer_awaits_set;
54953
55032
  priv.viewer_stale = "";
54954
55033
  priv.viewer_awaits = shown;
54955
55034
  priv.set_in_flight = {
54956
55035
  gclass: shown,
54957
- scope: "gclass"
55036
+ scope: "gclass",
55037
+ set_id
54958
55038
  };
54959
- gobj_publish_event(gobj, "EV_TRACE_INFO_WANTED", { gclass: shown });
55039
+ gobj_publish_event(gobj, "EV_TRACE_INFO_WANTED", {
55040
+ gclass: shown,
55041
+ set_id
55042
+ });
54960
55043
  }
54961
55044
  }
54962
55045
  if (shown === kw.gclass) gobj_send_event(viewer, "EV_SET_TRACES", viewer_traces(gobj, shown), gobj);
@@ -54964,6 +55047,22 @@ function ac_trace_info(gobj, event, kw, src) {
54964
55047
  return 0;
54965
55048
  }
54966
55049
  /************************************************************
55050
+ * Is this answer (EV_LOAD_TREE, EV_TRACE_INFO) the one that
55051
+ * follows the set `set_id`?
55052
+ *
55053
+ * A host that echoes `set_id` says so itself: null for a read
55054
+ * that is no set's, which is a read asked BEFORE the set when
55055
+ * it arrives after it (REV-CLOUD V40.2: the card's own read,
55056
+ * answered after a tick, unlocked the block and showed the
55057
+ * levels before the set, enabled, for one round trip). A host
55058
+ * that leaves it out (before 7.27.33) cannot say: any answer
55059
+ * will do, and the caller matches by gclass.
55060
+ ************************************************************/
55061
+ function answers_set(kw, set_id) {
55062
+ if (!kw || kw.set_id === void 0) return true;
55063
+ return !!set_id && kw.set_id === set_id;
55064
+ }
55065
+ /************************************************************
54967
55066
  * The gclass viewer this view opened, while it is open.
54968
55067
  ************************************************************/
54969
55068
  function gclass_viewer_gobj(gobj) {
@@ -55059,11 +55158,14 @@ function ac_set_gclass_trace(gobj, event, kw, src) {
55059
55158
  }
55060
55159
  function set_trace_levels(gobj, target, scope, levels, set) {
55061
55160
  let priv = gobj.priv;
55161
+ let set_id = ++priv.set_serial;
55062
55162
  priv.trace_pending = true;
55163
+ priv.pending_set_id = set_id;
55063
55164
  render_current_popover(gobj);
55064
55165
  priv.set_in_flight = {
55065
55166
  gclass: target.gclass,
55066
- scope
55167
+ scope,
55168
+ set_id
55067
55169
  };
55068
55170
  let viewer = gclass_viewer_gobj(gobj);
55069
55171
  if (viewer) {
@@ -55075,13 +55177,15 @@ function set_trace_levels(gobj, target, scope, levels, set) {
55075
55177
  gobj: target.full_name || "",
55076
55178
  gclass: target.gclass,
55077
55179
  levels,
55078
- set
55180
+ set,
55181
+ set_id
55079
55182
  });
55080
55183
  }
55081
55184
  function lock_viewer_for_set(gobj, shown, set) {
55082
55185
  let priv = gobj.priv;
55083
55186
  if (!(shown === set.gclass || set.scope === "global")) return false;
55084
55187
  priv.viewer_awaits = set.gclass;
55188
+ priv.viewer_awaits_set = set.set_id;
55085
55189
  priv.viewer_stale = shown !== set.gclass ? shown : "";
55086
55190
  return true;
55087
55191
  }
@@ -55932,7 +56036,7 @@ function apply_active_route(gobj) {
55932
56036
  let $c = gobj_read_attr(gobj, "$container");
55933
56037
  let route = gobj_read_attr(gobj, "active_route") || "";
55934
56038
  if (!$c || empty_string(route)) return;
55935
- let $a = $c.querySelector(`a[data-route="${css_escape(route)}"]`);
56039
+ let $a = $c.querySelector(`a[data-route="${css_string(route)}"]`);
55936
56040
  if ($a) {
55937
56041
  let $li = $a.closest("li");
55938
56042
  if ($li) $li.classList.add("is-active");
@@ -56560,7 +56664,7 @@ function ac_set_item_badge(gobj, event, kw, src) {
56560
56664
  gobj_write_attr(gobj, "badges", badges);
56561
56665
  let $c = gobj_read_attr(gobj, "$container");
56562
56666
  if (!$c) return 0;
56563
- let $badges = $c.querySelectorAll(`[data-item-id="${css_escape(item_id)}"] .NAV_ITEM_BADGE`);
56667
+ let $badges = $c.querySelectorAll(`[data-item-id="${css_string(item_id)}"] .NAV_ITEM_BADGE`);
56564
56668
  for (let $badge of $badges) paint_badge($badge, badge, tone);
56565
56669
  return 0;
56566
56670
  }
@@ -56584,7 +56688,7 @@ function ac_route_changed(gobj, event, kw, src) {
56584
56688
  id_to_mark = parent_item ? parent_item.id : item && item.id;
56585
56689
  } else id_to_mark = item && item.id;
56586
56690
  if (!id_to_mark) return 0;
56587
- let $a = $c.querySelector(`[data-item-id="${css_escape(id_to_mark)}"]`);
56691
+ let $a = $c.querySelector(`[data-item-id="${css_string(id_to_mark)}"]`);
56588
56692
  if ($a) {
56589
56693
  let $li = $a.closest("li");
56590
56694
  if ($li) $li.classList.add("is-active");
@@ -56595,7 +56699,7 @@ function ac_route_changed(gobj, event, kw, src) {
56595
56699
  $c.querySelectorAll(".yui-accordion-head").forEach(($hd) => {
56596
56700
  let $body = $hd.nextElementSibling;
56597
56701
  if (!$body || !$body.classList.contains("yui-accordion-body")) return;
56598
- let contains_active = !!$body.querySelector(`[data-item-id="${css_escape(active_leaf_id)}"]`);
56702
+ let contains_active = !!$body.querySelector(`[data-item-id="${css_string(active_leaf_id)}"]`);
56599
56703
  $body.classList.toggle("is-hidden", !contains_active);
56600
56704
  $hd.classList.toggle("is-open", contains_active);
56601
56705
  $hd.setAttribute("aria-expanded", contains_active ? "true" : "false");
@@ -56603,9 +56707,6 @@ function ac_route_changed(gobj, event, kw, src) {
56603
56707
  }
56604
56708
  return 0;
56605
56709
  }
56606
- function css_escape(s) {
56607
- return String(s).replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
56608
- }
56609
56710
  /***************************************************************
56610
56711
  * FSM
56611
56712
  ***************************************************************/
@@ -59485,7 +59586,7 @@ function ac_show$5(gobj, event, kw, src) {
59485
59586
  }
59486
59587
  let $container = gobj_read_attr(gobj, "$container");
59487
59588
  let $current_item = gobj_read_attr(gobj, "$current_item");
59488
- let $a = $container.querySelector(`a[href="${href}"]`);
59589
+ let $a = $container.querySelector(`a[href="${css_string(href)}"]`);
59489
59590
  if ($a) {
59490
59591
  if ($current_item && $current_item !== $a.parentNode) {
59491
59592
  $current_item.classList.remove("is-active");
@@ -61520,7 +61621,7 @@ function build_ui$5(gobj) {
61520
61621
  [yui_toolbar_icon("yi-magnifying-glass")]
61521
61622
  ]]
61522
61623
  ]);
61523
- let $search_input = $search_box.querySelector(`#${search_id}`);
61624
+ let $search_input = find_by_id($search_box, search_id);
61524
61625
  attach_clear($search_box, $search_input);
61525
61626
  if ($search_input) $search_input.addEventListener("input", (event) => {
61526
61627
  gobj_send_event(gobj, "EV_SEARCH", { text: event.target.value.trim() }, gobj);
@@ -61680,7 +61781,7 @@ function build_ui$5(gobj) {
61680
61781
  });
61681
61782
  gobj_write_attr(gobj, "selection_bar", bar);
61682
61783
  bar.$el.style.flex = "none";
61683
- $container.insertBefore(bar.$el, $container.querySelector(`#${table_id}`));
61784
+ $container.insertBefore(bar.$el, find_by_id($container, table_id));
61684
61785
  }
61685
61786
  let $parent_filter = createElement2([
61686
61787
  "div",
@@ -61725,7 +61826,7 @@ function build_ui$5(gobj) {
61725
61826
  ]
61726
61827
  ]);
61727
61828
  gobj.priv.$parent_filter = $parent_filter;
61728
- $container.insertBefore($parent_filter, $container.querySelector(`#${table_id}`));
61829
+ $container.insertBefore($parent_filter, find_by_id($container, table_id));
61729
61830
  let $toolbar_slot = $container.querySelector(".toolbar_tabulator_table");
61730
61831
  if ($table_toolbar instanceof Element) $toolbar_slot.appendChild($table_toolbar);
61731
61832
  else $toolbar_slot.appendChild(createElement2(["div", {}]));
@@ -62172,7 +62273,7 @@ function create_tabulator(gobj) {
62172
62273
  autoResize: false
62173
62274
  });
62174
62275
  let $view_container = gobj_read_attr(gobj, "$container");
62175
- let $table_el = $view_container ? $view_container.querySelector(`#${table_id}`) : null;
62276
+ let $table_el = $view_container ? find_by_id($view_container, table_id) : null;
62176
62277
  if (!$table_el) {
62177
62278
  log_error(`${gobj_short_name(gobj)}: table element '#${table_id}' not found in $container`);
62178
62279
  return;
@@ -75873,7 +75974,7 @@ function mt_create$3(gobj) {
75873
75974
  if (gobj_read_bool_attr(gobj, "readonly") && priv.operation_mode === "edition") gobj_write_str_attr(gobj, "operation_mode", "reading");
75874
75975
  let canvas_id = clean_name(gobj_name(gobj)) + "-canvas";
75875
75976
  gobj_write_attr(gobj, "canvas_id", canvas_id);
75876
- let $container_canvas = build_ui$3(gobj).querySelector(`#${priv.canvas_id}`);
75977
+ let $container_canvas = find_by_id(build_ui$3(gobj), priv.canvas_id);
75877
75978
  priv.gobj_nodes_tree = gobj_create_service(`${gobj_name(gobj)}-g6`, "C_G6_NODES_TREE", {
75878
75979
  $container: $container_canvas,
75879
75980
  subscriber: gobj,
@@ -78581,6 +78682,7 @@ var __gclass__$2 = null;
78581
78682
  * Framework Methods
78582
78683
  ******************************/
78583
78684
  function mt_create$2(gobj) {
78685
+ ensure_drag_canvas_patch();
78584
78686
  ensure_pinch_zoom_patch();
78585
78687
  build_ui$2(gobj);
78586
78688
  let subscriber = gobj_read_pointer_attr(gobj, "subscriber");
@@ -82924,7 +83026,7 @@ function form_changes(initial, values) {
82924
83026
  function apply_form_changes(gobj, $form, changes) {
82925
83027
  for (let name of Object.keys(changes)) {
82926
83028
  if (name === "flag") continue;
82927
- let $control = $form.querySelector(`[data-name="${name}"]`);
83029
+ let $control = $form.querySelector(`[data-name="${css_string(name)}"]`);
82928
83030
  if (!$control) {
82929
83031
  log_warning(`${gobj_short_name(gobj)}: a change of '${name}' has no field in the form opened again: not put back`);
82930
83032
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.27.32",
3
+ "version": "7.27.33",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -44,6 +44,7 @@
44
44
  "@rollup/plugin-terser": "^1.0.2",
45
45
  "@vitest/coverage-v8": "^5.0.5",
46
46
  "@yuneta/gobj-js": "^7.27.0",
47
+ "jsdom": "^30.1.3",
47
48
  "vite": "^8.3.5",
48
49
  "vitest": "^5.0.5"
49
50
  },
package/src/c_yui_form.js CHANGED
@@ -102,6 +102,7 @@ import {
102
102
  import {form_time_cell_editor} from "./form_time_cell_editor.js";
103
103
  import {yui_tabulator_keep_edit_on_redraw, yui_tabulator_close_editor} from "./yui_tabulator_edit.js";
104
104
  import {safe_locale} from "./yui_date_text.js";
105
+ import {css_string} from "./yui_selector.js";
105
106
  import {parse_json_field, json_editor_value} from "./form_json_field.js";
106
107
  import {
107
108
  json_editor_menu_items,
@@ -1369,7 +1370,7 @@ function apply_form_mode(gobj, $form)
1369
1370
  }
1370
1371
 
1371
1372
  let pkey = gobj_read_str_attr(gobj, "pkey");
1372
- let $input = $form.querySelector(`[name="${pkey}"]`);
1373
+ let $input = $form.querySelector(`[name="${css_string(pkey)}"]`);
1373
1374
  if(!$input) {
1374
1375
  log_error(sprintf("%s: form_mode '%s' but form has no pkey field '%s'",
1375
1376
  gobj_short_name(gobj), mode, pkey
@@ -2720,7 +2721,7 @@ function template2columns(gobj, columns, template, sub_elements)
2720
2721
  cellClick: function(evt, cell) {
2721
2722
  evt.stopPropagation();
2722
2723
  let $row = cell.getRow().getElement();
2723
- let $extend = $row.querySelector(`[name="${field_desc.name}"]`);
2724
+ let $extend = $row.querySelector(`[name="${css_string(field_desc.name)}"]`);
2724
2725
  if(!$extend) {
2725
2726
  log_error(`${gobj_short_name(gobj)}: nested table '${field_desc.name}' not found in its row`);
2726
2727
  return;
@@ -72,6 +72,7 @@ import {yui_is_dark, yui_theme_now, yui_watch_theme} from "./yui_theme.js";
72
72
  import {ensure_drag_canvas_patch} from "./g6_drag_canvas_touch.js";
73
73
  import {ensure_pinch_zoom_patch} from "./g6_touch_gestures.js";
74
74
  import {keep_canvas_tab_order} from "./g6_canvas_tab_order.js";
75
+ import {find_by_id} from "./yui_selector.js";
75
76
 
76
77
  import {t} from "i18next";
77
78
 
@@ -360,7 +361,7 @@ function canvas_mount(gobj)
360
361
  if(!$container) {
361
362
  return null;
362
363
  }
363
- return $container.querySelector("#" + gobj_read_str_attr(gobj, "canvas_id"));
364
+ return find_by_id($container, gobj_read_str_attr(gobj, "canvas_id"));
364
365
  }
365
366
 
366
367
  /************************************************************
@@ -12,12 +12,13 @@
12
12
  * it WANTS and the host answers with the data:
13
13
  *
14
14
  * out EV_TREE_WANTED {} Refresh pressed
15
- * in EV_LOAD_TREE {tree} the `view-gobj-tree` answer
16
- * out EV_TRACE_INFO_WANTED {gclass} a card was opened
15
+ * in EV_LOAD_TREE {tree, set_id} the `view-gobj-tree` answer
16
+ * out EV_TRACE_INFO_WANTED {gclass, set_id} a card was opened
17
17
  * in EV_TRACE_INFO {gclass, gclass_levels, global_levels,
18
- * gclass_on, global_on, error}
18
+ * gclass_on, global_on, error, set_id}
19
19
  * out EV_SET_TRACE_LEVEL {scope: "gobj"|"gclass"|"global",
20
- * gobj, gclass, levels: [...], set}
20
+ * gobj, gclass, levels: [...], set,
21
+ * set_id}
21
22
  * out EV_GCLASS_WANTED {gclass} the gclass button
22
23
  * in EV_GCLASS_DESCRIPTION {gclass, description}
23
24
  *
@@ -27,6 +28,14 @@
27
28
  * trace info of `gclass` again: what the reader is on stays
28
29
  * open.
29
30
  *
31
+ * `set_id` (7.27.33) numbers each set. A host that echoes
32
+ * it says WHICH set an answer follows: the set_id of the
33
+ * set in the two reads made after it (and in the answer of
34
+ * a WANTED that carried one), null in any other answer. A
35
+ * read asked BEFORE a set and answered after it then no
36
+ * longer unlocks what the set locked. A host that leaves
37
+ * it out is matched by gclass, as before.
38
+ *
30
39
  * TRACES, in "remote": three scopes, each where it belongs.
31
40
  * The kernel's levels (`machine`, `create_delete`...; the
32
41
  * table gobj.c calls "global") are valid in all three, a
@@ -143,6 +152,7 @@ import { ensure_pinch_zoom_patch } from "./g6_touch_gestures.js";
143
152
  import { yui_is_dark, yui_theme_now, yui_watch_theme } from "./yui_theme.js";
144
153
  import {g6_event_kw} from "./g6_event_kw.js";
145
154
  import {keep_canvas_tab_order} from "./g6_canvas_tab_order.js";
155
+ import {find_by_id, css_string} from "./yui_selector.js";
146
156
  import {yui_graph_minimap_options, yui_graph_minimap_block} from "./yui_graph_minimap.js";
147
157
 
148
158
  /***************************************************************
@@ -498,7 +508,10 @@ let PRIVATE_DATA = {
498
508
  popover_mode: "", // what the popover shows: "node" (a card) | "yuno" (the yuno's traces)
499
509
  viewer_awaits: "", // the gclass whose answer unlocks the open viewer ("" = not locked)
500
510
  viewer_stale: "", // a gclass whose open viewer must be asked again after a yuno set
501
- set_in_flight: null, // {gclass, scope}: the set whose answer (EV_TRACE_INFO of gclass) is owed
511
+ set_in_flight: null, // {gclass, scope, set_id}: the set whose answer (EV_TRACE_INFO of gclass) is owed
512
+ set_serial: 0, // numbers the sets (set_id), so an answer can say which one it follows
513
+ pending_set_id: 0, // the set the locked blocks wait for
514
+ viewer_awaits_set: 0, // the set whose answer unlocks the open viewer
502
515
  view_refused: false, // the saved camera showed no card: the opening's framing replaces it
503
516
  };
504
517
 
@@ -1351,7 +1364,7 @@ function canvas_mount(gobj)
1351
1364
  if(!$container) {
1352
1365
  return null;
1353
1366
  }
1354
- return $container.querySelector("#" + gobj.priv.canvas_id);
1367
+ return find_by_id($container, gobj.priv.canvas_id);
1355
1368
  }
1356
1369
 
1357
1370
  /************************************************************
@@ -3291,7 +3304,7 @@ function paint_anchor_mark(gobj)
3291
3304
  return;
3292
3305
  }
3293
3306
  let $it = $container.querySelector(
3294
- '.GOBJ_CARD[data-gobj-name="' + CSS.escape(priv.anchor_name) + '"]'
3307
+ '.GOBJ_CARD[data-gobj-name="' + css_string(priv.anchor_name) + '"]'
3295
3308
  );
3296
3309
  if($it) {
3297
3310
  $it.classList.add('GOBJ_CARD_ANCHORED');
@@ -3667,7 +3680,9 @@ function ac_load_tree(gobj, event, kw, src)
3667
3680
  }
3668
3681
  let first = !priv.remote_root;
3669
3682
  priv.remote_root = root;
3670
- priv.trace_pending = false;
3683
+ if(answers_set(kw, priv.pending_set_id)) {
3684
+ priv.trace_pending = false;
3685
+ }
3671
3686
  reload_keeping_popover(gobj, first? {}: {preserve_view: true});
3672
3687
  return 0;
3673
3688
  }
@@ -3691,8 +3706,11 @@ function ac_trace_info(gobj, event, kw, src)
3691
3706
  global_on: list(kw.global_on),
3692
3707
  error: kw.error || "",
3693
3708
  };
3694
- priv.trace_pending = false;
3695
- if(priv.set_in_flight && priv.set_in_flight.gclass === kw.gclass) {
3709
+ if(answers_set(kw, priv.pending_set_id)) {
3710
+ priv.trace_pending = false;
3711
+ }
3712
+ if(priv.set_in_flight && priv.set_in_flight.gclass === kw.gclass &&
3713
+ answers_set(kw, priv.set_in_flight.set_id)) {
3696
3714
  priv.set_in_flight = null;
3697
3715
  }
3698
3716
 
@@ -3709,18 +3727,21 @@ function ac_trace_info(gobj, event, kw, src)
3709
3727
  /* Only the answer the viewer waits for unlocks it: an answer
3710
3728
  * for another gclass (another card's set) is none of its
3711
3729
  * business. */
3712
- if(priv.viewer_awaits === kw.gclass) {
3730
+ if(priv.viewer_awaits === kw.gclass && answers_set(kw, priv.viewer_awaits_set)) {
3713
3731
  priv.viewer_awaits = "";
3714
3732
  if(priv.viewer_stale === shown && shown !== kw.gclass) {
3715
3733
  /* A set of the YUNO's scope: what the viewer shows as
3716
3734
  * held by the yuno moved too, and the host refreshed
3717
- * only the root's gclass. Locked until its own. */
3735
+ * only the root's gclass. Locked until its own -- a
3736
+ * read that is part of the set, so it carries the
3737
+ * set's number. */
3738
+ let set_id = priv.viewer_awaits_set;
3718
3739
  priv.viewer_stale = "";
3719
3740
  priv.viewer_awaits = shown;
3720
3741
  /* Owed like a set of its own: a viewer of it reopened
3721
3742
  * before the answer opens locked too. */
3722
- priv.set_in_flight = {gclass: shown, scope: "gclass"};
3723
- gobj_publish_event(gobj, "EV_TRACE_INFO_WANTED", {gclass: shown});
3743
+ priv.set_in_flight = {gclass: shown, scope: "gclass", set_id: set_id};
3744
+ gobj_publish_event(gobj, "EV_TRACE_INFO_WANTED", {gclass: shown, set_id: set_id});
3724
3745
  }
3725
3746
  }
3726
3747
  if(shown === kw.gclass) {
@@ -3730,6 +3751,26 @@ function ac_trace_info(gobj, event, kw, src)
3730
3751
  return 0;
3731
3752
  }
3732
3753
 
3754
+ /************************************************************
3755
+ * Is this answer (EV_LOAD_TREE, EV_TRACE_INFO) the one that
3756
+ * follows the set `set_id`?
3757
+ *
3758
+ * A host that echoes `set_id` says so itself: null for a read
3759
+ * that is no set's, which is a read asked BEFORE the set when
3760
+ * it arrives after it (REV-CLOUD V40.2: the card's own read,
3761
+ * answered after a tick, unlocked the block and showed the
3762
+ * levels before the set, enabled, for one round trip). A host
3763
+ * that leaves it out (before 7.27.33) cannot say: any answer
3764
+ * will do, and the caller matches by gclass.
3765
+ ************************************************************/
3766
+ function answers_set(kw, set_id)
3767
+ {
3768
+ if(!kw || kw.set_id === undefined) {
3769
+ return true;
3770
+ }
3771
+ return !!set_id && kw.set_id === set_id;
3772
+ }
3773
+
3733
3774
  /************************************************************
3734
3775
  * The gclass viewer this view opened, while it is open.
3735
3776
  ************************************************************/
@@ -3852,7 +3893,9 @@ function ac_set_gclass_trace(gobj, event, kw, src)
3852
3893
  function set_trace_levels(gobj, target, scope, levels, set)
3853
3894
  {
3854
3895
  let priv = gobj.priv;
3896
+ let set_id = ++priv.set_serial;
3855
3897
  priv.trace_pending = true;
3898
+ priv.pending_set_id = set_id;
3856
3899
  render_current_popover(gobj);
3857
3900
 
3858
3901
  /* The viewer is locked only by a set that moves what it shows:
@@ -3861,7 +3904,7 @@ function set_trace_levels(gobj, target, scope, levels, set)
3861
3904
  * ends that set is not one the viewer would ever be sent. The set
3862
3905
  * is remembered for a viewer opened before its answer, and only
3863
3906
  * the LAST one: the host overtakes an earlier set in flight. */
3864
- priv.set_in_flight = {gclass: target.gclass, scope: scope};
3907
+ priv.set_in_flight = {gclass: target.gclass, scope: scope, set_id: set_id};
3865
3908
  let viewer = gclass_viewer_gobj(gobj);
3866
3909
  if(viewer) {
3867
3910
  let shown = gobj_read_str_attr(viewer, "gclass_name");
@@ -3876,6 +3919,7 @@ function set_trace_levels(gobj, target, scope, levels, set)
3876
3919
  gclass: target.gclass,
3877
3920
  levels: levels,
3878
3921
  set: set,
3922
+ set_id: set_id,
3879
3923
  });
3880
3924
  }
3881
3925
 
@@ -3891,6 +3935,7 @@ function lock_viewer_for_set(gobj, shown, set)
3891
3935
  return false;
3892
3936
  }
3893
3937
  priv.viewer_awaits = set.gclass;
3938
+ priv.viewer_awaits_set = set.set_id;
3894
3939
  priv.viewer_stale = (shown !== set.gclass)? shown: "";
3895
3940
  return true;
3896
3941
  }