@yuneta/gobj-ui 7.27.31 → 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.
package/README.md CHANGED
@@ -3349,15 +3349,34 @@ and it declares the four output events in its FSM:
3349
3349
  | Direction | Event | kw | The host does |
3350
3350
  |---|---|---|---|
3351
3351
  | out | `EV_TREE_WANTED` | `{}` | `view-gobj-tree`, then `EV_LOAD_TREE` (Refresh was pressed) |
3352
- | in | `EV_LOAD_TREE` | `{tree}` | — the `view-gobj-tree` answer's `data` |
3353
- | out | `EV_TRACE_INFO_WANTED` | `{gclass}` | `info-gclass-trace gclass=G`, `info-global-trace`, `get-gclass-trace gclass=G`, `get-global-trace`, then `EV_TRACE_INFO` (a card was opened) |
3354
- | in | `EV_TRACE_INFO` | `{gclass, gclass_levels, global_levels, gclass_on, global_on, error}` | — the four answers (`{name: description}`, `{name: description}`, `[name]`, `[name]`), or `error` |
3355
- | out | `EV_SET_TRACE_LEVEL` | `{scope, gobj, gclass, levels, set}` | per level `set-gobj-trace gobj=<gobj> level=L set=0\|1` (scope `gobj`) or `set-gclass-trace gclass=G level=L set=0\|1` (scope `gclass`), then the tree and the trace info again |
3352
+ | in | `EV_LOAD_TREE` | `{tree, set_id}` | — the `view-gobj-tree` answer's `data` |
3353
+ | out | `EV_TRACE_INFO_WANTED` | `{gclass, set_id}` | `info-gclass-trace gclass=G`, `info-global-trace`, `get-gclass-trace gclass=G`, `get-global-trace`, then `EV_TRACE_INFO` (a card was opened) |
3354
+ | in | `EV_TRACE_INFO` | `{gclass, gclass_levels, global_levels, gclass_on, global_on, error, set_id}` | — the four answers (`{name: description}`, `{name: description}`, `[name]`, `[name]`), or `error` |
3355
+ | out | `EV_SET_TRACE_LEVEL` | `{scope, gobj, gclass, levels, set, set_id}` | per level `set-gobj-trace gobj=<gobj> level=L set=0\|1` (scope `gobj`) or `set-gclass-trace gclass=G level=L set=0\|1` (scope `gclass`), then the tree and the trace info again |
3356
3356
  | out | `EV_GCLASS_WANTED` | `{gclass}` | `view-gclass gclass=G`, then `EV_GCLASS_DESCRIPTION` |
3357
3357
  | in | `EV_GCLASS_DESCRIPTION` | `{gclass, description}` | — opens the gclass viewer on that description |
3358
3358
 
3359
3359
  The host loads the **first** tree itself (it opened the view); after that the
3360
- view asks only on Refresh. Ask `view-gobj-tree` for the fields the view reads,
3360
+ view asks only on Refresh.
3361
+
3362
+ **`set_id` says which set an answer follows** (7.27.33). Every
3363
+ `EV_SET_TRACE_LEVEL` carries a new number. A host that echoes it puts it in the
3364
+ two answers it reads after that set (`EV_LOAD_TREE`, `EV_TRACE_INFO`) and in the
3365
+ answer of an `EV_TRACE_INFO_WANTED` that carried one, and puts `set_id: null`
3366
+ in every other answer. Then a read asked BEFORE a set and answered after it
3367
+ does not unlock what the set locked: without it, a card's own read answered
3368
+ after a tick showed the levels before the set, enabled, for one round trip. A
3369
+ host that leaves `set_id` out of its answers keeps working as before: the view
3370
+ matches an answer by its gclass.
3371
+
3372
+ ```js
3373
+ /* the host, after the last command of a set: */
3374
+ gobj_send_event(priv.view.tree, "EV_TRACE_INFO",
3375
+ Object.assign({gclass: "C_TCP", set_id: kw_of_the_set.set_id}, the_four_answers), gobj);
3376
+ /* a plain read (a card was opened): */
3377
+ gobj_send_event(priv.view.tree, "EV_TRACE_INFO",
3378
+ Object.assign({gclass: "C_TCP", set_id: null}, the_four_answers), gobj);
3379
+ ``` Ask `view-gobj-tree` for the fields the view reads,
3361
3380
  by name (`options=[...]`): its default leaves out `gclass` and `fullname`, and
3362
3381
  `play_methods` is what keeps a gobj with nothing to play from reading paused.
3363
3382
 
@@ -4393,6 +4412,20 @@ text is in the yunetas `CLAUDE.md` ("JS GUI conventions"); in short:
4393
4412
 
4394
4413
  `npm run check-markup` runs the check here, and `prebuild` / `pretest` run
4395
4414
  it, so a new markup literal fails the build.
4415
+ - **Data never goes into a CSS selector as it is.** A gobj name, a topic, a
4416
+ route or a key may hold `~`, `.`, `%`, `"`... Pasted into
4417
+ `querySelector()`, it changes what the selector says (`#a~b` matches no
4418
+ element) or makes it invalid, and then `querySelector()` THROWS out of the
4419
+ action that called it. Find an element by its id with `find_by_id($root,
4420
+ id)`, and quote a value for an attribute selector with `css_string()`
4421
+ (`yui_selector.js`, 7.27.33):
4422
+
4423
+ ```js
4424
+ import {find_by_id, css_string} from "@yuneta/gobj-ui/src/yui_selector.js";
4425
+
4426
+ let $canvas = find_by_id($container, priv.canvas_id);
4427
+ let $a = $c.querySelector(`a[data-route="${css_string(route)}"]`);
4428
+ ```
4396
4429
 
4397
4430
  ### `index.html`: title, metadata and the Content-Security-Policy
4398
4431
 
@@ -1102,6 +1102,72 @@ function build_nav_map(input) {
1102
1102
  };
1103
1103
  }
1104
1104
  //#endregion
1105
+ //#region src/yui_selector.js
1106
+ /***********************************************************************
1107
+ * yui_selector.js
1108
+ *
1109
+ * A NAME IS DATA, NOT A SELECTOR.
1110
+ *
1111
+ * A gobj name, a topic, a route, a key: any of them may hold a
1112
+ * character that means something to CSS. Pasted into a selector,
1113
+ * it changes what the selector says or breaks it:
1114
+ *
1115
+ * - `~ + > space` are combinators: `#a~b` is "a b after an #a",
1116
+ * and the lookup answers null;
1117
+ * - `.` `#` `:` `[` start another simple selector: `#a.b` is the
1118
+ * element #a with the class b;
1119
+ * - `%` `^` `"` `\` and the rest make it INVALID: querySelector
1120
+ * THROWS a SyntaxError, out of whatever action was running.
1121
+ *
1122
+ * REV-CLOUD V40.3.1: the gobj tree found its canvas with
1123
+ * `querySelector("#" + id)`, and gui_agent named the window
1124
+ * `node~key` -- every open logged "no canvas mount" and the
1125
+ * canvas never resized; a `^` in the key (`%5E`) threw out of
1126
+ * mt_start and left an orphan window behind it.
1127
+ *
1128
+ * So data reaches a selector in one of two ways only:
1129
+ *
1130
+ * find_by_id($root, id) the element below $root whose id is
1131
+ * `id` -- no selector is built at all.
1132
+ * It works in a tree that is not in the
1133
+ * document yet, where getElementById()
1134
+ * answers null.
1135
+ *
1136
+ * css_string(value) the value written inside a DOUBLE
1137
+ * quoted CSS string, for an attribute
1138
+ * selector:
1139
+ * '[data-x="' + css_string(v) + '"]'
1140
+ *
1141
+ * `CSS.escape()` is not used: it does not exist in node, where the
1142
+ * wiring tests run, and inside a quoted string only the quote, the
1143
+ * backslash and the control characters have to be escaped.
1144
+ *
1145
+ * Copyright (c) 2026, ArtGins.
1146
+ * All Rights Reserved.
1147
+ ***********************************************************************/
1148
+ /************************************************************
1149
+ * The element below `$root` (not `$root` itself, as with
1150
+ * querySelector) whose id is exactly `id`, or null.
1151
+ ************************************************************/
1152
+ function find_by_id($root, id) {
1153
+ if (!$root || typeof $root.querySelectorAll !== "function") return null;
1154
+ if (id === null || id === void 0 || id === "") return null;
1155
+ let wanted = String(id);
1156
+ for (let $el of $root.querySelectorAll("[id]")) if ($el.id === wanted) return $el;
1157
+ return null;
1158
+ }
1159
+ /************************************************************
1160
+ * `value` as the body of a double-quoted CSS string.
1161
+ *
1162
+ * The quote and the backslash take a backslash; a control
1163
+ * character (a newline ends a CSS string, it is a parse
1164
+ * error inside one) is written as its hex escape, which a
1165
+ * space ends so the next character is never read as hex.
1166
+ ************************************************************/
1167
+ function css_string(value) {
1168
+ return String(value).replace(/[\\"]/g, "\\$&").replace(/[\u0000-\u001f\u007f]/g, (c) => "\\" + c.charCodeAt(0).toString(16) + " ");
1169
+ }
1170
+ //#endregion
1105
1171
  //#region src/shell_section_index.js
1106
1172
  /***********************************************************************
1107
1173
  * shell_section_index.js
@@ -4184,7 +4250,7 @@ function yui_shell_set_connection_state(shell_gobj, connected) {
4184
4250
  function yui_shell_set_toolbar_item_icon(shell_gobj, item_id, icon_class) {
4185
4251
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(shell_gobj, "$container");
4186
4252
  if (!$container || (0, _yuneta_gobj_js.empty_string)(item_id) || (0, _yuneta_gobj_js.empty_string)(icon_class)) return;
4187
- let $i = $container.querySelector(`[data-toolbar-item-id="${item_id}"] .icon i`);
4253
+ let $i = $container.querySelector(`[data-toolbar-item-id="${css_string(item_id)}"] .icon i`);
4188
4254
  if ($i) $i.className = icon_class;
4189
4255
  }
4190
4256
  /************************************************************
@@ -4218,7 +4284,7 @@ function yui_shell_set_toolbar_item_badge(shell_gobj, item_id, value, tone) {
4218
4284
  if (!shell_gobj || !(0, _yuneta_gobj_js.is_gobj)(shell_gobj) || (0, _yuneta_gobj_js.empty_string)(item_id)) return;
4219
4285
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(shell_gobj, "$container");
4220
4286
  if (!$container) return;
4221
- let $badge = $container.querySelector(`[data-toolbar-item-id="${item_id}"] .yui-toolbar-badge`);
4287
+ let $badge = $container.querySelector(`[data-toolbar-item-id="${css_string(item_id)}"] .yui-toolbar-badge`);
4222
4288
  if (!$badge) return;
4223
4289
  let before = $badge.hasAttribute("hidden") ? "" : $badge.textContent;
4224
4290
  paint_badge($badge, value, tone);
@@ -12583,7 +12649,7 @@ function apply_form_mode(gobj, $form) {
12583
12649
  let mode = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "form_mode");
12584
12650
  if ((0, _yuneta_gobj_js.empty_string)(mode)) return;
12585
12651
  let pkey = (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "pkey");
12586
- let $input = $form.querySelector(`[name="${pkey}"]`);
12652
+ let $input = $form.querySelector(`[name="${css_string(pkey)}"]`);
12587
12653
  if (!$input) {
12588
12654
  (0, _yuneta_gobj_js.log_error)((0, _yuneta_gobj_js.sprintf)("%s: form_mode '%s' but form has no pkey field '%s'", (0, _yuneta_gobj_js.gobj_short_name)(gobj), mode, pkey));
12589
12655
  return;
@@ -13651,7 +13717,7 @@ function template2columns(gobj, columns, template, sub_elements) {
13651
13717
  hozAlign: "center",
13652
13718
  cellClick: function(evt, cell) {
13653
13719
  evt.stopPropagation();
13654
- let $extend = cell.getRow().getElement().querySelector(`[name="${field_desc.name}"]`);
13720
+ let $extend = cell.getRow().getElement().querySelector(`[name="${css_string(field_desc.name)}"]`);
13655
13721
  if (!$extend) {
13656
13722
  (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: nested table '${field_desc.name}' not found in its row`);
13657
13723
  return;
@@ -17186,6 +17252,41 @@ function classify_press(press, x, y, t) {
17186
17252
  return "tap";
17187
17253
  }
17188
17254
  //#endregion
17255
+ //#region src/g6_replace_behavior.js
17256
+ /***********************************************************************
17257
+ * g6_replace_behavior.js
17258
+ *
17259
+ * Replace one of G6's built-in behaviors, without a warning on
17260
+ * every page load.
17261
+ *
17262
+ * gobj-ui replaces two built-ins on purpose (`drag-canvas` and
17263
+ * `zoom-canvas`, the touch round of 7.23.9), so that every graph
17264
+ * gets the fix without touching its behaviors list. G6's
17265
+ * `register()` warns whenever a type is registered again --
17266
+ * "The extension drag-canvas of behavior has been registered
17267
+ * before, and will be overridden" -- and its `print` is not
17268
+ * exported, so the warning cannot be muted. It went to the
17269
+ * console of every app that draws a graph, on every load.
17270
+ *
17271
+ * `getExtensions(category)` hands out G6's live registry, so the
17272
+ * replacement is written there. Whether it took is checked with
17273
+ * `getExtension()`: a G6 that hands out a copy one day gets the
17274
+ * replacement through `register()` -- with its warning, which
17275
+ * then says something -- instead of losing it in silence.
17276
+ *
17277
+ * Copyright (c) 2026, ArtGins.
17278
+ * All Rights Reserved.
17279
+ ***********************************************************************/
17280
+ /************************************************************
17281
+ * Make `Ctor` the behavior `type`, replacing the built-in.
17282
+ ************************************************************/
17283
+ function replace_g6_behavior(type, Ctor) {
17284
+ const category = _antv_g6.ExtensionCategory.BEHAVIOR;
17285
+ const behaviors = (0, _antv_g6.getExtensions)(category);
17286
+ if (behaviors && (0, _antv_g6.getExtension)(category, type)) behaviors[type] = Ctor;
17287
+ if ((0, _antv_g6.getExtension)(category, type) !== Ctor) (0, _antv_g6.register)(category, type, Ctor);
17288
+ }
17289
+ //#endregion
17189
17290
  //#region src/g6_touch_gestures.js
17190
17291
  /***********************************************************************
17191
17292
  * g6_touch_gestures.js
@@ -17387,7 +17488,7 @@ var ZoomCanvasPinch = class extends _antv_g6.ZoomCanvas {
17387
17488
  var __zoom_canvas_patched__ = false;
17388
17489
  function ensure_pinch_zoom_patch() {
17389
17490
  if (__zoom_canvas_patched__) return;
17390
- (0, _antv_g6.register)(_antv_g6.ExtensionCategory.BEHAVIOR, "zoom-canvas", ZoomCanvasPinch);
17491
+ replace_g6_behavior("zoom-canvas", ZoomCanvasPinch);
17391
17492
  __zoom_canvas_patched__ = true;
17392
17493
  }
17393
17494
  /***************************
@@ -17630,7 +17731,7 @@ var DragCanvasTouch = class extends _antv_g6.DragCanvas {
17630
17731
  var __drag_canvas_patched__ = false;
17631
17732
  function ensure_drag_canvas_patch() {
17632
17733
  if (__drag_canvas_patched__) return;
17633
- (0, _antv_g6.register)(_antv_g6.ExtensionCategory.BEHAVIOR, "drag-canvas", DragCanvasTouch);
17734
+ replace_g6_behavior("drag-canvas", DragCanvasTouch);
17634
17735
  __drag_canvas_patched__ = true;
17635
17736
  }
17636
17737
  //#endregion
@@ -18074,7 +18175,7 @@ function build_ui$13(gobj) {
18074
18175
  ]]
18075
18176
  ]);
18076
18177
  (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "$container", $container);
18077
- let $mount = $container.querySelector("#" + priv.canvas_id);
18178
+ let $mount = find_by_id($container, priv.canvas_id);
18078
18179
  if ($mount) {
18079
18180
  priv.fold_listener = function(evt) {
18080
18181
  let $handle = evt.target && evt.target.closest ? evt.target.closest("[data-fold-path]") : null;
@@ -18103,7 +18204,7 @@ function destroy_ui$8(gobj) {
18103
18204
  let priv = gobj.priv;
18104
18205
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
18105
18206
  if (priv.fold_listener) {
18106
- let $mount = $container ? $container.querySelector("#" + priv.canvas_id) : null;
18207
+ let $mount = find_by_id($container, priv.canvas_id);
18107
18208
  if ($mount) for (let type of FOLD_SWALLOWED_EVENTS$1) $mount.removeEventListener(type, priv.fold_listener, true);
18108
18209
  priv.fold_listener = null;
18109
18210
  }
@@ -18244,7 +18345,7 @@ function make_toolbar$5(gobj) {
18244
18345
  function canvas_mount$2(gobj) {
18245
18346
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
18246
18347
  if (!$container) return null;
18247
- return $container.querySelector("#" + gobj.priv.canvas_id);
18348
+ return find_by_id($container, gobj.priv.canvas_id);
18248
18349
  }
18249
18350
  /************************************************************
18250
18351
  * Build a G6 graph instance
@@ -19115,7 +19216,7 @@ function paint_anchor_mark$1(gobj) {
19115
19216
  if (!$container) return;
19116
19217
  for (let $card of $container.querySelectorAll(".JSON_CARD_ANCHORED")) $card.classList.remove("JSON_CARD_ANCHORED");
19117
19218
  if (priv.anchor_state !== "on" || !priv.anchor_path) return;
19118
- let $it = $container.querySelector(".JSON_CARD[data-json-path=\"" + CSS.escape(priv.anchor_path) + "\"]");
19219
+ let $it = $container.querySelector(".JSON_CARD[data-json-path=\"" + css_string(priv.anchor_path) + "\"]");
19119
19220
  if ($it) $it.classList.add("JSON_CARD_ANCHORED");
19120
19221
  }
19121
19222
  /************************************************************
@@ -22581,7 +22682,7 @@ function make_toolbar$3(gobj) {
22581
22682
  function canvas_mount$1(gobj) {
22582
22683
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
22583
22684
  if (!$container) return null;
22584
- return $container.querySelector("#" + (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "canvas_id"));
22685
+ return find_by_id($container, (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "canvas_id"));
22585
22686
  }
22586
22687
  /************************************************************
22587
22688
  * Build the G6 graph instance.
@@ -52213,12 +52314,13 @@ function yui_graph_minimap_repaint(plugin) {
52213
52314
  * it WANTS and the host answers with the data:
52214
52315
  *
52215
52316
  * out EV_TREE_WANTED {} Refresh pressed
52216
- * in EV_LOAD_TREE {tree} the `view-gobj-tree` answer
52217
- * out EV_TRACE_INFO_WANTED {gclass} a card was opened
52317
+ * in EV_LOAD_TREE {tree, set_id} the `view-gobj-tree` answer
52318
+ * out EV_TRACE_INFO_WANTED {gclass, set_id} a card was opened
52218
52319
  * in EV_TRACE_INFO {gclass, gclass_levels, global_levels,
52219
- * gclass_on, global_on, error}
52320
+ * gclass_on, global_on, error, set_id}
52220
52321
  * out EV_SET_TRACE_LEVEL {scope: "gobj"|"gclass"|"global",
52221
- * gobj, gclass, levels: [...], set}
52322
+ * gobj, gclass, levels: [...], set,
52323
+ * set_id}
52222
52324
  * out EV_GCLASS_WANTED {gclass} the gclass button
52223
52325
  * in EV_GCLASS_DESCRIPTION {gclass, description}
52224
52326
  *
@@ -52228,6 +52330,14 @@ function yui_graph_minimap_repaint(plugin) {
52228
52330
  * trace info of `gclass` again: what the reader is on stays
52229
52331
  * open.
52230
52332
  *
52333
+ * `set_id` (7.27.33) numbers each set. A host that echoes
52334
+ * it says WHICH set an answer follows: the set_id of the
52335
+ * set in the two reads made after it (and in the answer of
52336
+ * a WANTED that carried one), null in any other answer. A
52337
+ * read asked BEFORE a set and answered after it then no
52338
+ * longer unlocks what the set locked. A host that leaves
52339
+ * it out is matched by gclass, as before.
52340
+ *
52231
52341
  * TRACES, in "remote": three scopes, each where it belongs.
52232
52342
  * The kernel's levels (`machine`, `create_delete`...; the
52233
52343
  * table gobj.c calls "global") are valid in all three, a
@@ -52442,6 +52552,9 @@ var PRIVATE_DATA$9 = {
52442
52552
  viewer_awaits: "",
52443
52553
  viewer_stale: "",
52444
52554
  set_in_flight: null,
52555
+ set_serial: 0,
52556
+ pending_set_id: 0,
52557
+ viewer_awaits_set: 0,
52445
52558
  view_refused: false
52446
52559
  };
52447
52560
  var __gclass__$9 = null;
@@ -53173,7 +53286,7 @@ function make_toolbar$1(gobj) {
53173
53286
  function canvas_mount(gobj) {
53174
53287
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
53175
53288
  if (!$container) return null;
53176
- return $container.querySelector("#" + gobj.priv.canvas_id);
53289
+ return find_by_id($container, gobj.priv.canvas_id);
53177
53290
  }
53178
53291
  /************************************************************
53179
53292
  * Build a G6 graph instance
@@ -54647,7 +54760,7 @@ function paint_anchor_mark(gobj) {
54647
54760
  if (!$container) return;
54648
54761
  for (let $card of $container.querySelectorAll(".GOBJ_CARD_ANCHORED")) $card.classList.remove("GOBJ_CARD_ANCHORED");
54649
54762
  if (priv.anchor_state !== "on" || !priv.anchor_name) return;
54650
- let $it = $container.querySelector(".GOBJ_CARD[data-gobj-name=\"" + CSS.escape(priv.anchor_name) + "\"]");
54763
+ let $it = $container.querySelector(".GOBJ_CARD[data-gobj-name=\"" + css_string(priv.anchor_name) + "\"]");
54651
54764
  if ($it) $it.classList.add("GOBJ_CARD_ANCHORED");
54652
54765
  }
54653
54766
  /************************************************************
@@ -54887,7 +55000,7 @@ function ac_load_tree(gobj, event, kw, src) {
54887
55000
  }
54888
55001
  let first = !priv.remote_root;
54889
55002
  priv.remote_root = root;
54890
- priv.trace_pending = false;
55003
+ if (answers_set(kw, priv.pending_set_id)) priv.trace_pending = false;
54891
55004
  reload_keeping_popover(gobj, first ? {} : { preserve_view: true });
54892
55005
  return 0;
54893
55006
  }
@@ -54909,24 +55022,29 @@ function ac_trace_info(gobj, event, kw, src) {
54909
55022
  global_on: list(kw.global_on),
54910
55023
  error: kw.error || ""
54911
55024
  };
54912
- priv.trace_pending = false;
54913
- if (priv.set_in_flight && priv.set_in_flight.gclass === kw.gclass) priv.set_in_flight = null;
55025
+ if (answers_set(kw, priv.pending_set_id)) priv.trace_pending = false;
55026
+ 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;
54914
55027
  let d = priv.popover_node;
54915
55028
  let root = priv.remote_root;
54916
55029
  if (priv.popover_mode === "node" && d && d.gclass === kw.gclass || priv.popover_mode === "yuno" && root && root.gclass === kw.gclass) render_current_popover(gobj);
54917
55030
  let viewer = gclass_viewer_gobj(gobj);
54918
55031
  if (viewer) {
54919
55032
  let shown = (0, _yuneta_gobj_js.gobj_read_str_attr)(viewer, "gclass_name");
54920
- if (priv.viewer_awaits === kw.gclass) {
55033
+ if (priv.viewer_awaits === kw.gclass && answers_set(kw, priv.viewer_awaits_set)) {
54921
55034
  priv.viewer_awaits = "";
54922
55035
  if (priv.viewer_stale === shown && shown !== kw.gclass) {
55036
+ let set_id = priv.viewer_awaits_set;
54923
55037
  priv.viewer_stale = "";
54924
55038
  priv.viewer_awaits = shown;
54925
55039
  priv.set_in_flight = {
54926
55040
  gclass: shown,
54927
- scope: "gclass"
55041
+ scope: "gclass",
55042
+ set_id
54928
55043
  };
54929
- (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_TRACE_INFO_WANTED", { gclass: shown });
55044
+ (0, _yuneta_gobj_js.gobj_publish_event)(gobj, "EV_TRACE_INFO_WANTED", {
55045
+ gclass: shown,
55046
+ set_id
55047
+ });
54930
55048
  }
54931
55049
  }
54932
55050
  if (shown === kw.gclass) (0, _yuneta_gobj_js.gobj_send_event)(viewer, "EV_SET_TRACES", viewer_traces(gobj, shown), gobj);
@@ -54934,6 +55052,22 @@ function ac_trace_info(gobj, event, kw, src) {
54934
55052
  return 0;
54935
55053
  }
54936
55054
  /************************************************************
55055
+ * Is this answer (EV_LOAD_TREE, EV_TRACE_INFO) the one that
55056
+ * follows the set `set_id`?
55057
+ *
55058
+ * A host that echoes `set_id` says so itself: null for a read
55059
+ * that is no set's, which is a read asked BEFORE the set when
55060
+ * it arrives after it (REV-CLOUD V40.2: the card's own read,
55061
+ * answered after a tick, unlocked the block and showed the
55062
+ * levels before the set, enabled, for one round trip). A host
55063
+ * that leaves it out (before 7.27.33) cannot say: any answer
55064
+ * will do, and the caller matches by gclass.
55065
+ ************************************************************/
55066
+ function answers_set(kw, set_id) {
55067
+ if (!kw || kw.set_id === void 0) return true;
55068
+ return !!set_id && kw.set_id === set_id;
55069
+ }
55070
+ /************************************************************
54937
55071
  * The gclass viewer this view opened, while it is open.
54938
55072
  ************************************************************/
54939
55073
  function gclass_viewer_gobj(gobj) {
@@ -55029,11 +55163,14 @@ function ac_set_gclass_trace(gobj, event, kw, src) {
55029
55163
  }
55030
55164
  function set_trace_levels(gobj, target, scope, levels, set) {
55031
55165
  let priv = gobj.priv;
55166
+ let set_id = ++priv.set_serial;
55032
55167
  priv.trace_pending = true;
55168
+ priv.pending_set_id = set_id;
55033
55169
  render_current_popover(gobj);
55034
55170
  priv.set_in_flight = {
55035
55171
  gclass: target.gclass,
55036
- scope
55172
+ scope,
55173
+ set_id
55037
55174
  };
55038
55175
  let viewer = gclass_viewer_gobj(gobj);
55039
55176
  if (viewer) {
@@ -55045,13 +55182,15 @@ function set_trace_levels(gobj, target, scope, levels, set) {
55045
55182
  gobj: target.full_name || "",
55046
55183
  gclass: target.gclass,
55047
55184
  levels,
55048
- set
55185
+ set,
55186
+ set_id
55049
55187
  });
55050
55188
  }
55051
55189
  function lock_viewer_for_set(gobj, shown, set) {
55052
55190
  let priv = gobj.priv;
55053
55191
  if (!(shown === set.gclass || set.scope === "global")) return false;
55054
55192
  priv.viewer_awaits = set.gclass;
55193
+ priv.viewer_awaits_set = set.set_id;
55055
55194
  priv.viewer_stale = shown !== set.gclass ? shown : "";
55056
55195
  return true;
55057
55196
  }
@@ -55902,7 +56041,7 @@ function apply_active_route(gobj) {
55902
56041
  let $c = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
55903
56042
  let route = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "active_route") || "";
55904
56043
  if (!$c || (0, _yuneta_gobj_js.empty_string)(route)) return;
55905
- let $a = $c.querySelector(`a[data-route="${css_escape(route)}"]`);
56044
+ let $a = $c.querySelector(`a[data-route="${css_string(route)}"]`);
55906
56045
  if ($a) {
55907
56046
  let $li = $a.closest("li");
55908
56047
  if ($li) $li.classList.add("is-active");
@@ -56530,7 +56669,7 @@ function ac_set_item_badge(gobj, event, kw, src) {
56530
56669
  (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "badges", badges);
56531
56670
  let $c = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
56532
56671
  if (!$c) return 0;
56533
- let $badges = $c.querySelectorAll(`[data-item-id="${css_escape(item_id)}"] .NAV_ITEM_BADGE`);
56672
+ let $badges = $c.querySelectorAll(`[data-item-id="${css_string(item_id)}"] .NAV_ITEM_BADGE`);
56534
56673
  for (let $badge of $badges) paint_badge($badge, badge, tone);
56535
56674
  return 0;
56536
56675
  }
@@ -56554,7 +56693,7 @@ function ac_route_changed(gobj, event, kw, src) {
56554
56693
  id_to_mark = parent_item ? parent_item.id : item && item.id;
56555
56694
  } else id_to_mark = item && item.id;
56556
56695
  if (!id_to_mark) return 0;
56557
- let $a = $c.querySelector(`[data-item-id="${css_escape(id_to_mark)}"]`);
56696
+ let $a = $c.querySelector(`[data-item-id="${css_string(id_to_mark)}"]`);
56558
56697
  if ($a) {
56559
56698
  let $li = $a.closest("li");
56560
56699
  if ($li) $li.classList.add("is-active");
@@ -56565,7 +56704,7 @@ function ac_route_changed(gobj, event, kw, src) {
56565
56704
  $c.querySelectorAll(".yui-accordion-head").forEach(($hd) => {
56566
56705
  let $body = $hd.nextElementSibling;
56567
56706
  if (!$body || !$body.classList.contains("yui-accordion-body")) return;
56568
- let contains_active = !!$body.querySelector(`[data-item-id="${css_escape(active_leaf_id)}"]`);
56707
+ let contains_active = !!$body.querySelector(`[data-item-id="${css_string(active_leaf_id)}"]`);
56569
56708
  $body.classList.toggle("is-hidden", !contains_active);
56570
56709
  $hd.classList.toggle("is-open", contains_active);
56571
56710
  $hd.setAttribute("aria-expanded", contains_active ? "true" : "false");
@@ -56573,9 +56712,6 @@ function ac_route_changed(gobj, event, kw, src) {
56573
56712
  }
56574
56713
  return 0;
56575
56714
  }
56576
- function css_escape(s) {
56577
- return String(s).replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
56578
- }
56579
56715
  /***************************************************************
56580
56716
  * FSM
56581
56717
  ***************************************************************/
@@ -59455,7 +59591,7 @@ function ac_show$5(gobj, event, kw, src) {
59455
59591
  }
59456
59592
  let $container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
59457
59593
  let $current_item = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$current_item");
59458
- let $a = $container.querySelector(`a[href="${href}"]`);
59594
+ let $a = $container.querySelector(`a[href="${css_string(href)}"]`);
59459
59595
  if ($a) {
59460
59596
  if ($current_item && $current_item !== $a.parentNode) {
59461
59597
  $current_item.classList.remove("is-active");
@@ -61490,7 +61626,7 @@ function build_ui$5(gobj) {
61490
61626
  [yui_toolbar_icon("yi-magnifying-glass")]
61491
61627
  ]]
61492
61628
  ]);
61493
- let $search_input = $search_box.querySelector(`#${search_id}`);
61629
+ let $search_input = find_by_id($search_box, search_id);
61494
61630
  attach_clear($search_box, $search_input);
61495
61631
  if ($search_input) $search_input.addEventListener("input", (event) => {
61496
61632
  (0, _yuneta_gobj_js.gobj_send_event)(gobj, "EV_SEARCH", { text: event.target.value.trim() }, gobj);
@@ -61650,7 +61786,7 @@ function build_ui$5(gobj) {
61650
61786
  });
61651
61787
  (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "selection_bar", bar);
61652
61788
  bar.$el.style.flex = "none";
61653
- $container.insertBefore(bar.$el, $container.querySelector(`#${table_id}`));
61789
+ $container.insertBefore(bar.$el, find_by_id($container, table_id));
61654
61790
  }
61655
61791
  let $parent_filter = (0, _yuneta_gobj_js.createElement2)([
61656
61792
  "div",
@@ -61695,7 +61831,7 @@ function build_ui$5(gobj) {
61695
61831
  ]
61696
61832
  ]);
61697
61833
  gobj.priv.$parent_filter = $parent_filter;
61698
- $container.insertBefore($parent_filter, $container.querySelector(`#${table_id}`));
61834
+ $container.insertBefore($parent_filter, find_by_id($container, table_id));
61699
61835
  let $toolbar_slot = $container.querySelector(".toolbar_tabulator_table");
61700
61836
  if ($table_toolbar instanceof Element) $toolbar_slot.appendChild($table_toolbar);
61701
61837
  else $toolbar_slot.appendChild((0, _yuneta_gobj_js.createElement2)(["div", {}]));
@@ -62142,7 +62278,7 @@ function create_tabulator(gobj) {
62142
62278
  autoResize: false
62143
62279
  });
62144
62280
  let $view_container = (0, _yuneta_gobj_js.gobj_read_attr)(gobj, "$container");
62145
- let $table_el = $view_container ? $view_container.querySelector(`#${table_id}`) : null;
62281
+ let $table_el = $view_container ? find_by_id($view_container, table_id) : null;
62146
62282
  if (!$table_el) {
62147
62283
  (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: table element '#${table_id}' not found in $container`);
62148
62284
  return;
@@ -75843,7 +75979,7 @@ function mt_create$3(gobj) {
75843
75979
  if ((0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj, "readonly") && priv.operation_mode === "edition") (0, _yuneta_gobj_js.gobj_write_str_attr)(gobj, "operation_mode", "reading");
75844
75980
  let canvas_id = (0, _yuneta_gobj_js.clean_name)((0, _yuneta_gobj_js.gobj_name)(gobj)) + "-canvas";
75845
75981
  (0, _yuneta_gobj_js.gobj_write_attr)(gobj, "canvas_id", canvas_id);
75846
- let $container_canvas = build_ui$3(gobj).querySelector(`#${priv.canvas_id}`);
75982
+ let $container_canvas = find_by_id(build_ui$3(gobj), priv.canvas_id);
75847
75983
  priv.gobj_nodes_tree = (0, _yuneta_gobj_js.gobj_create_service)(`${(0, _yuneta_gobj_js.gobj_name)(gobj)}-g6`, "C_G6_NODES_TREE", {
75848
75984
  $container: $container_canvas,
75849
75985
  subscriber: gobj,
@@ -78551,6 +78687,7 @@ var __gclass__$2 = null;
78551
78687
  * Framework Methods
78552
78688
  ******************************/
78553
78689
  function mt_create$2(gobj) {
78690
+ ensure_drag_canvas_patch();
78554
78691
  ensure_pinch_zoom_patch();
78555
78692
  build_ui$2(gobj);
78556
78693
  let subscriber = (0, _yuneta_gobj_js.gobj_read_pointer_attr)(gobj, "subscriber");
@@ -82894,7 +83031,7 @@ function form_changes(initial, values) {
82894
83031
  function apply_form_changes(gobj, $form, changes) {
82895
83032
  for (let name of Object.keys(changes)) {
82896
83033
  if (name === "flag") continue;
82897
- let $control = $form.querySelector(`[data-name="${name}"]`);
83034
+ let $control = $form.querySelector(`[data-name="${css_string(name)}"]`);
82898
83035
  if (!$control) {
82899
83036
  (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: a change of '${name}' has no field in the form opened again: not put back`);
82900
83037
  continue;